Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3051987ybb; Sun, 12 Apr 2020 22:43:59 -0700 (PDT) X-Google-Smtp-Source: APiQypL5sC+vUD07FRScf6JwRvtrCBFMGhQZob8goBBm+NgNWZCN3BiZZgYndZJqOJfr3F85RuaO X-Received: by 2002:ae9:dd85:: with SMTP id r127mr14156712qkf.58.1586756638950; Sun, 12 Apr 2020 22:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586756638; cv=none; d=google.com; s=arc-20160816; b=aEjqgRIn4jF3Hjc6fekAF7osDbu25BpEs6LMxdELWNbuvZJJHHorNYZ4+Fv7IVDmSd EpZk6gIzZeRSinuoKnq3kGl+I1SCTo2Jz49LPxP27iVatYA4FcJfRaRAsPMq9ewR/CyP S9+GZ4sDMyqmLuFKRr7Qyu1DfHlN8dkVrpJK1C6UlhjZdUSbPbwFjW+PHHbxe3/0OdU0 H0zd+FL0Uony5mbETLAWUXfyUeMJHO6/eYX8ilrMBJ0ieDjuMrcL3GoBnxNSzMHV+Pvi uICtBcHW+vYdBwzXSitr+2564sl0O6IJfcNtH7n/M/SjwFuIGBo84b70hKt+h+T+z7ql Z2mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=4grsY0tBiJNvCv1cZE3pNpyp46aTfDS3gAC5bXUUJr8=; b=FHj/6/NhiDYpKyteajlncyh1E2pbnx0gerGpnMhFH+OyW/mAMqJ9vv0QEtZgeAW1qq iM3xfco23yGPNt/WwvAd+XUVwn0iJVsk4m5nZbU9DmnY8mQC2r0G987y0QtemsCjaCP9 JsmARO61i2UF4jDoXaOIDkgit7ebJbJaJBaknAygaks3JBOgdO41T5EwWiwDEyWz/9gZ SlRQvYK8BQ67fKpKBRQsaoJwJAnbk9LdArHKyVJ+LcZ17me3dxE0FAfv5HuCYiHf0nL+ rYCJ8936+9Mo0gelnb2nF0rPbutBTyKWyJcLxfWaT1coVGWH88ydkaGGRccTxa7WMtNG Xz0w== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-kernel-owner@vger.kernel.org) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org ([209.132.180.67]) by mx.google.com with ESMTP id k141si2247014qke.172.2020.04.12.22.43.44; Sun, 12 Apr 2020 22:43:58 -0700 (PDT) Received-SPF: neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-kernel-owner@vger.kernel.org) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-kernel-owner@vger.kernel.org) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726951AbgDMBYR (ORCPT + 99 others); Sun, 12 Apr 2020 21:24:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.18]:58156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726917AbgDMBYR (ORCPT ); Sun, 12 Apr 2020 21:24:17 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FCEFC0A3BE0 for ; Sun, 12 Apr 2020 18:24:17 -0700 (PDT) IronPort-SDR: boHGRWVogPUkS5P7sIRXfvqHQosGQgkbKWk3rKXNHuqL+7woYD8vU6w7fz6iuu6w14gmzQpwre BnbyPKRoYscw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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