Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3856899pxk; Tue, 22 Sep 2020 04:36:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+cT96TA7T4XZQFVS1ECj/hw02xKwsr63INL4RCpmqvLwQEym9J0OdhXEOMMwJnnY0MZmH X-Received: by 2002:a17:906:3755:: with SMTP id e21mr4370710ejc.39.1600774616585; Tue, 22 Sep 2020 04:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600774616; cv=none; d=google.com; s=arc-20160816; b=F3kMKwVy5grcRB+JYr+koX9yqavSi3yMIyR4HsDpo8sNV7ytwzPqEM7C5VJharWN1w 9jEDIxtu4m2mc9Ecp/xxbTHuwvNXuru1VDx1iaaNE3ehdraUwEnIAxKe/yd3i8wcJpD2 i0lRNJwaM7hvodHBT7EnGxM6jooSPclmA/hP9g1fuhyxQnRVMJNVm9dzsZ680g3W7fcB DmNYSCAu8iAysOoxTLEyLlRFeb8IeZgVNYVVj5yHV0R/rX+SrwA6NiN1JgonYTWf/Hz0 NbmYqteoMEST9o/4AgBPFR350FyXZaYtV0vRkF/9Qunoh5m7wJE0U30wyiUtVnRlxXz+ ud0g== 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:references :in-reply-to:date:cc:to:from:subject:message-id; bh=hNlPXJwcllfFyEMOUyENiaCJsQRE3y0zkUxGoxkeUOI=; b=roS3ZGtpBhP3vFlt351z+icr4YCbaAWrhs3ZLDzom/u20TvUDLVWdw/sUuvibH0mhj Ggj0LPIljHg+LAO9rPeCHnrz5H3efJmrKrFSSY84rWxqJVbwdbRMDULxFo2K/P4G/9oU FF/nzmDMldXpijegthZrPQzLc0OgyX8FMRa/bijLldj0Aba3pZ3wlx2Airy6b+DKQ96W DzhGOLVhyy8Vot/YV/btWLDyLcZaQWPqxBzOWMDpEFq0RrZ4N8eNOLfuVh+dxBPjdsJW y3/9bbLFPbPfybNcL40tzyia2RkzygLPfZ2dbxqMTEd0WRxi9RatseFPG91J3GvBXKsE VPHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m18si10121325ejc.93.2020.09.22.04.36.32; Tue, 22 Sep 2020 04:36:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726541AbgIVLdS (ORCPT + 99 others); Tue, 22 Sep 2020 07:33:18 -0400 Received: from shelob.surriel.com ([96.67.55.147]:46952 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726454AbgIVLdS (ORCPT ); Tue, 22 Sep 2020 07:33:18 -0400 Received: from imladris.surriel.com ([96.67.55.152]) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kKgXj-0000Pi-RK; Tue, 22 Sep 2020 07:33:07 -0400 Message-ID: Subject: Re: [PATCH 2/2] mm,swap: skip swap readahead if page was obtained instantaneously From: Rik van Riel To: huang ying Cc: LKML , linux-mm@kvack.org, kernel-team@fb.com, niketa@fb.com, Andrew Morton , Seth Jennings , Dan Streetman , Konrad Rzeszutek Wilk , Johannes Weiner , Huang Ying Date: Tue, 22 Sep 2020 07:33:04 -0400 In-Reply-To: References: <20200922020148.3261797-1-riel@surriel.com> <20200922020148.3261797-3-riel@surriel.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-8MKjSXOxtDuFixMXbchb" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Sender: riel@shelob.surriel.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-8MKjSXOxtDuFixMXbchb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2020-09-22 at 11:13 +0800, huang ying wrote: > On Tue, Sep 22, 2020 at 10:02 AM Rik van Riel > wrote: > > Check whether a swap page was obtained instantaneously, for example > > because it is in zswap, or on a very fast IO device which uses busy > > waiting, and we did not wait on IO to swap in this page. > > If no IO was needed to get the swap page we want, kicking off > > readahead > > on surrounding swap pages is likely to be counterproductive, > > because the > > extra loads will cause additional latency, use up extra memory, and > > chances > > are the surrounding pages in swap are just as fast to load as this > > one, > > making readahead pointless. > >=20 > > Signed-off-by: Rik van Riel > > --- > > mm/swap_state.c | 14 +++++++++++--- > > 1 file changed, 11 insertions(+), 3 deletions(-) > >=20 > > diff --git a/mm/swap_state.c b/mm/swap_state.c > > index aacb9ba53f63..6919f9d5fe88 100644 > > --- a/mm/swap_state.c > > +++ b/mm/swap_state.c > > @@ -637,6 +637,7 @@ static struct page > > *swap_cluster_read_one(swp_entry_t entry, > > struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t > > gfp_mask, > > struct vm_fault *vmf) >=20 > Why not do this for swap_vma_readahead() > too? swap_cluster_read_one() > can be used in swap_vma_readahead() too. Good point, I should do the same thing for swap_vma_readahead() as well. Let me do that and send in a version 2 of the series. --=20 All Rights Reversed. --=-8MKjSXOxtDuFixMXbchb Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAl9p4PAACgkQznnekoTE 3oOotQf/SOLtQCYmAlruLunQUSY8oebSOdi8lRDlN0/RmW3HMSPFoNgGUTTXZrpg HwNm1Ads9KRHPnGhm734NJo4y35cY3Gbp32TlF/LGx67dGa3u8eNKsh0KCEcvBOY yLq6vm+q6+FAjDwUvGnXLhk3NUSsUsLKf/dFQVG6EOnS/9yzwBNTQGUmBjpVgHl2 5diVd6cbrds2KIWyffAPuV7uj2qWX/HoHtS0Nhw3olCYhxBUVDUkks8gvF9LTl18 tha1rkkURTYVdOUQcpwenif1t+kWkpmSZuNeM/C6+9A1BbU/PDYitVjq3GFj2PcI WI8ur3DrcKI8ac/86hJjBi161rkWww== =hW7V -----END PGP SIGNATURE----- --=-8MKjSXOxtDuFixMXbchb--