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 4B027C2BA19 for ; Mon, 13 Apr 2020 13:13:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0C3092072C for ; Mon, 13 Apr 2020 13:13:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C3092072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B04038E0113; Mon, 13 Apr 2020 09:13:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AB4E58E0104; Mon, 13 Apr 2020 09:13:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9CA638E0113; Mon, 13 Apr 2020 09:13:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0098.hostedemail.com [216.40.44.98]) by kanga.kvack.org (Postfix) with ESMTP id 86B308E0104 for ; Mon, 13 Apr 2020 09:13:38 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 4DB994DCD for ; Mon, 13 Apr 2020 13:13:38 +0000 (UTC) X-FDA: 76702873716.25.hook64_59e2c68391b48 X-HE-Tag: hook64_59e2c68391b48 X-Filterd-Recvd-Size: 2694 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Mon, 13 Apr 2020 13:13:37 +0000 (UTC) IronPort-SDR: YNyRCIzK7AueB9nG9RUFTpOvfhwoA28EiEWb/emZ1E/G2TXlpJi6bBChhvuuZmPZ0sMryRXHrv vlfUiYVdYFnA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2020 06:13:36 -0700 IronPort-SDR: EBarXwOJVuLuIhZVVqFQ5Ln6ll8U7Rpxf8g0h9ogMC3BvyKdu46ZUNzdUW5NOpgy6c7bXX4gTX 0FE9zkRtP9Gw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,378,1580803200"; d="scan'208";a="399603024" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.159.23]) by orsmga004.jf.intel.com with ESMTP; 13 Apr 2020 06:13:34 -0700 From: "Huang\, Ying" To: Andrea Righi Cc: Andrew Morton , Minchan Kim , Anchal Agarwal , , Subject: Re: [PATCH v2] mm: swap: use fixed-size readahead during swapoff References: <20200413111810.GA801367@xps-13> Date: Mon, 13 Apr 2020 21:13:33 +0800 In-Reply-To: <20200413111810.GA801367@xps-13> (Andrea Righi's message of "Mon, 13 Apr 2020 13:18:10 +0200") Message-ID: <875ze37cle.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii 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: 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 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? Best Regards, Huang, Ying