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=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 07D6CC433ED for ; Wed, 19 May 2021 02:12:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7715460FE5 for ; Wed, 19 May 2021 02:12:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7715460FE5 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 946C68E006A; Tue, 18 May 2021 22:12:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F60C8E002F; Tue, 18 May 2021 22:12:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 76FE68E006A; Tue, 18 May 2021 22:12:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0066.hostedemail.com [216.40.44.66]) by kanga.kvack.org (Postfix) with ESMTP id 465AA8E002F for ; Tue, 18 May 2021 22:12:55 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E2515BA04 for ; Wed, 19 May 2021 02:12:54 +0000 (UTC) X-FDA: 78156357468.17.773DD18 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by imf13.hostedemail.com (Postfix) with ESMTP id C44C7E00010A for ; Wed, 19 May 2021 02:12:51 +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.2) (envelope-from ) id 1ljBhT-0007c4-Hi; Tue, 18 May 2021 22:12:43 -0400 Message-ID: <7b2525ba7871e6b8ce3f48cfd2375804a6791a94.camel@surriel.com> Subject: Re: [PATCH] mm: move idle swap cache pages to the tail of LRU after COW From: Rik van Riel To: Huang Ying , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Matthew Wilcox , Linus Torvalds , Peter Xu , Hugh Dickins , Johannes Weiner , Mel Gorman , Andrea Arcangeli , Michal Hocko , Dave Hansen , Tim Chen Date: Tue, 18 May 2021 22:12:42 -0400 In-Reply-To: <20210519013313.1274454-1-ying.huang@intel.com> References: <20210519013313.1274454-1-ying.huang@intel.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-+Nrc0dF5GFqX39nniyXu" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=none; spf=none (imf13.hostedemail.com: domain of riel@shelob.surriel.com has no SPF policy when checking 96.67.55.147) smtp.mailfrom=riel@shelob.surriel.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: C44C7E00010A X-Stat-Signature: 3itce9766acjwb8bzuo1yqp61crzzyp3 X-HE-Tag: 1621390371-264329 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: --=-+Nrc0dF5GFqX39nniyXu Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2021-05-19 at 09:33 +0800, Huang Ying wrote: > To test the patch, we used pmbench memory accessing benchmark with > working-set larger than available memory on a 2-socket Intel server > with a NVMe SSD as swap device. Test results shows that the pmbench > score increases up to 21.8% with the decreased size of swap cache and > swapin throughput. Nice! > +++ b/mm/memory.c > @@ -3012,6 +3012,11 @@ static vm_fault_t wp_page_copy(struct vm_fault > *vmf) > munlock_vma_page(old_page); > unlock_page(old_page); > } > + if (page_copied && PageSwapCache(old_page) && > + !page_mapped(old_page) && trylock_page(old_page)) { > + try_to_free_idle_swapcache(old_page); > + unlock_page(old_page); > + } That's quite the if condition! Would it make sense to move some of the tests, as well as the trylock and unlock into try_to_free_idle_swapcache() itself? Especially considering that page_mapped is already tested in that function, too... > put_page(old_page); > } --=20 All Rights Reversed. --=-+Nrc0dF5GFqX39nniyXu Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAmCkdBsACgkQznnekoTE 3oP/8wf+IHvOwx3SjsbsPXZHF7maNb3/rGGoplUC8wLZ8UCVZkmCEgu73qmQzrET VUCRzXxqiwcusFHfp5nj8LUoP7Cyyg8e7tLKPGtEeadoM22SNm+/LPUZV1ovUbIC PzuEj3A+8UzL6Tzvb01PV4kiYxTzhiN4/L1j8xK9G3AFfGHPfR75NTG8CPi59Uv+ osFW54seWNG03iLZnn2fzlfu3RUHfvqNNxcoxAbMATLJyIF3pCWEYr6mfmWF0bs7 9GmyKvtDkYK0lBmCTN+tVojYfqJ+D/4n+QDkzXCOQGa2KuUMu/pT5/oar7wfQFt/ eggA8J5VqSBKhgK/MKBIkPCADN+7Ig== =PxL1 -----END PGP SIGNATURE----- --=-+Nrc0dF5GFqX39nniyXu--