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=-9.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 D5733C2D0E2 for ; Tue, 22 Sep 2020 11:33:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A1E26239E5 for ; Tue, 22 Sep 2020 11:33:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726559AbgIVLdS (ORCPT ); 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-- 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=-9.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 83E5DC4727E for ; Tue, 22 Sep 2020 11:33:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BA06223600 for ; Tue, 22 Sep 2020 11:33:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA06223600 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E166C900066; Tue, 22 Sep 2020 07:33:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DC7C3900063; Tue, 22 Sep 2020 07:33:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB632900066; Tue, 22 Sep 2020 07:33:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0075.hostedemail.com [216.40.44.75]) by kanga.kvack.org (Postfix) with ESMTP id B6941900063 for ; Tue, 22 Sep 2020 07:33:20 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 79E4B1EE6 for ; Tue, 22 Sep 2020 11:33:20 +0000 (UTC) X-FDA: 77290486560.30.river63_521283b2714d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 41280180B3C83 for ; Tue, 22 Sep 2020 11:33:20 +0000 (UTC) X-HE-Tag: river63_521283b2714d X-Filterd-Recvd-Size: 3954 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Tue, 22 Sep 2020 11:33:19 +0000 (UTC) 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 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: --=-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--