From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C356C2BA19 for ; Mon, 13 Apr 2020 13:27:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CBD1C20692 for ; Mon, 13 Apr 2020 13:27:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBD1C20692 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 63DFE8E0115; Mon, 13 Apr 2020 09:27:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F05A8E0104; Mon, 13 Apr 2020 09:27:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DEC68E0115; Mon, 13 Apr 2020 09:27:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id 332178E0104 for ; Mon, 13 Apr 2020 09:27:03 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E20A52472 for ; Mon, 13 Apr 2020 13:27:02 +0000 (UTC) X-FDA: 76702907484.22.day22_3d7a675cf9e2e X-HE-Tag: day22_3d7a675cf9e2e X-Filterd-Recvd-Size: 4426 Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Mon, 13 Apr 2020 13:27:02 +0000 (UTC) Received: from mail-wm1-f70.google.com ([209.85.128.70]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jNz77-0003Ph-3D for linux-mm@kvack.org; Mon, 13 Apr 2020 13:27:01 +0000 Received: by mail-wm1-f70.google.com with SMTP id b203so2578325wmd.6 for ; Mon, 13 Apr 2020 06:27:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8+a15+2Tn0eUrhKMyhOqb9Aptpj40p6nDpz6wADNeys=; b=KY6m7L/lxpRTj16tbEWc3VusORfQbdi2ZcoQcROxNa1HmnDdszfim9+Fw2V2tmtHBZ E73Z3quj4clLiY4rSlb6ZPKNTxJw8lWaLWJvhwq0mX/46ex7LIE43C7JdzUDvfYqoV31 SSyNs8PghO0KgJE1evdYpnRpTkkGxkABatk5Y4gCGyKrZ65UNyCz/ptrxu3tvdjWoBCE l6rOvy0fL6t0cXOPUjoJFzjM0BfTNw9LH4MySNXflEC4O0S+ryqANyFPcw2+Nu5UDQtQ 1OBcr0sDxA5Y4uTmlDkl5rwAVV/R/U92R4bwt1TZVIj1WZliPWNkXgiK/czDgsziki4/ jJyg== X-Gm-Message-State: AGi0PuY63BF6NpnIEyCAPa3jh1vmtxr3eCeM+3tH3sBO1C4bWmwOnpEA 59jtREYcD5qdYFNsm4g2r+fry0En4hhpFkMtxo1pZeAdWR6I+C03bgMx6ZkY0Kg4zPaQ70R7Yze eThe4rnc+f3Xouw8vLQ43NzAA7dZO X-Received: by 2002:a1c:ba82:: with SMTP id k124mr19595750wmf.66.1586784420587; Mon, 13 Apr 2020 06:27:00 -0700 (PDT) X-Google-Smtp-Source: APiQypL1t64aMjzac+EttdBS3JKOOcE28EqF+BPRTU+l/HHGCxHjq+/gz6DzIjRh92m4ivlLeo6/Cw== X-Received: by 2002:a1c:ba82:: with SMTP id k124mr19595727wmf.66.1586784420259; Mon, 13 Apr 2020 06:27:00 -0700 (PDT) Received: from localhost (host123-127-dynamic.36-79-r.retail.telecomitalia.it. [79.36.127.123]) by smtp.gmail.com with ESMTPSA id w12sm201227wrk.56.2020.04.13.06.26.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2020 06:26:59 -0700 (PDT) Date: Mon, 13 Apr 2020 15:26:58 +0200 From: Andrea Righi To: "Huang, Ying" Cc: Andrew Morton , Minchan Kim , Anchal Agarwal , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm: swap: use fixed-size readahead during swapoff Message-ID: <20200413132658.GB801367@xps-13> References: <20200413111810.GA801367@xps-13> <875ze37cle.fsf@yhuang-dev.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <875ze37cle.fsf@yhuang-dev.intel.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Apr 13, 2020 at 09:13:33PM +0800, Huang, Ying wrote: > Andrea Righi writes: > > > The global swap-in readahead policy takes in account the previous access > > patterns, using a scaling heuristic to determine the optimal readahead > > chunk dynamically. > > > > This works pretty well in most cases, but like any heuristic there are > > specific cases when this approach is not ideal, for example the swapoff > > scenario. > > > > During swapoff we just want to load back into memory all the swapped-out > > pages and for this specific use case a fixed-size readahead is more > > efficient. > > > > The specific use case this patch is addressing is to improve swapoff > > performance when a VM has been hibernated, resumed and all memory needs > > to be forced back to RAM by disabling swap (see the test case below). > > Why do you need to swapoff after resuming? The swap device isn't used > except hibernation? I guess the process is, > > 1) add swap device to VM > 2) hibernate > 3) resume > 4) swapoff Correct, the swap device is used only for hibernation, when the system is resumed the swap is disabled (swapoff). > > Some pages are swapped out in step 2? If os, can we just set > /proc/sys/vm/swappiness to 0 to avoid swapping in step 2? Sorry, can you elaborate more on this? All anonymous pages are swapped out during step 2, it doesn't matter if we set swappiness to 0, they are swapped out anyway, because we need save them somewhere in order to hibernate, shutting down the system. Thanks, -Andrea