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 C06DEC2BBFD for ; Mon, 13 Apr 2020 01:24:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8F64F206C3 for ; Mon, 13 Apr 2020 01:24:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F64F206C3 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 2B9228E00F2; Sun, 12 Apr 2020 21:24:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 269918E00D0; Sun, 12 Apr 2020 21:24:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 17F2B8E00F2; Sun, 12 Apr 2020 21:24:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0182.hostedemail.com [216.40.44.182]) by kanga.kvack.org (Postfix) with ESMTP id F41878E00D0 for ; Sun, 12 Apr 2020 21:24:18 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A555352D6 for ; Mon, 13 Apr 2020 01:24:18 +0000 (UTC) X-FDA: 76701086196.23.bed59_87651c7a722d X-HE-Tag: bed59_87651c7a722d X-Filterd-Recvd-Size: 3199 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Mon, 13 Apr 2020 01:24:17 +0000 (UTC) IronPort-SDR: b0k88H7QXXg7dh/C4lzY+mIHwSnmuztByyKhibeePsjg1Stqh3NYJ0fneOeboFe0G6/IsOuZ/L 87OIQo945GDw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2020 18:24:16 -0700 IronPort-SDR: Mrmf+TZ6Ou8CfeylXgSh322PBioKgbMDU/Yyw9sBT9TKPo8AyRVp4kEhEHqeEJaj5zP3nr8Nvj iTn0Cn1pSRig== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,375,1580803200"; d="scan'208";a="453002077" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.159.23]) by fmsmga005.fm.intel.com with ESMTP; 12 Apr 2020 18:24:15 -0700 From: "Huang\, Ying" To: Andrea Righi Cc: Andrew Morton , Minchan Kim , Anchal Agarwal , , Subject: Re: [PATCH] mm: swap: introduce fixed-size readahead policy References: <20200412150449.GA740985@xps-13> Date: Mon, 13 Apr 2020 09:24:14 +0800 In-Reply-To: <20200412150449.GA740985@xps-13> (Andrea Righi's message of "Sun, 12 Apr 2020 17:04:49 +0200") Message-ID: <87d08c89fl.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: > Introduce a new fixed-size swap-in readahead policy that can be selected > at run-time. > > 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. > > This patch introduces a new sysfs interface > (/sys/kernel/mm/swap/swap_ra_policy) that can be set as following: > > - 0: current scaling swap-in readahead policy (default) > - 1: fixed-size readahead policy (size is determined by > vm.page-cluster) > > 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). I don't know whether the use case is important or not. Usually the performance of swapoff doesn't matter. Maybe you can provide some information on this. Even if it's important, I don't think we really need to add another ABI. You can just optimize the swapoff performance inside kernel. And we may not even need to add a new policy, just use cluster readahead and increase swapin_readahead_hits in swapoff if cluster readahead is used. Best Regards, Huang, Ying