Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1709041pxj; Wed, 19 May 2021 12:02:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdR/zrjJLsNzxxrXQO8Y77QgB5QL0xsXizlPMOGbUXuaZNkQYgTnFW5kS6Mry2cBE46RsY X-Received: by 2002:a02:6d13:: with SMTP id m19mr546448jac.65.1621450968311; Wed, 19 May 2021 12:02:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621450968; cv=none; d=google.com; s=arc-20160816; b=jdmgITj0w/FGlzsHIGE69skKbVaVTxnwK+uH5mP5itJ403PzUvjTOreQJtgUhIFckI cGGPPusUMaSJo/095qfWSBpcI9cetgSnAbOiZ4ckjBKW9A8uZEeuPHsIUIgq7KwYbdoP QryzQowQh/wdRDbzDz7WZEM775lFcgjDpjj6GBsyV3EvR3+jgpwsfaTdmJQrgcSji3fE RErBFm34VmqY9OC56djGX/CJyb34LjkHujQgzK2qU3kQoSIo9jgcfSiCMg5QJVEd+PGD 5gvuIHoZq1oMZQZA848ZSVa2h966BEVSMdu/ard4Mh650zya258rErV45AA00zvF2YLO tMPw== 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=YssiR8VDhV9FJ0+Z/DmpnLn3wQcOJe0W9HpMQvnsrw0=; b=bIHyFfiRA02ADcCmg0YBU32C5FkfLMucyQA7XfDq8F3OO5jGG98KbecVuy3fYljmu+ 33mDX9vwtTYb3t8sgTEr6qfbTpQ+XTUtu4qdTQaJtZOOBd0hCFUJpNK/mwcGP7b3eGlk UFfytp1XLIkY72dEw4GAimjIPc0emT4Ys+DGuzg3agAID8GtjJUmG9z6dGwfwqUT9z7p ryCHtBUqJOTd7atvdLTXsWnRzH5sUjnvSDyxw0+wPeTYKOCoIYpPc9haw8kV9MKLs1dw bpLUOeSiUftuNpcUrMSn4l2WjPKm1DjaujUde91fAf+HM8qDtl40wJ/n80GTiuH3Ctmi cvNQ== 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 g2si491973ilk.84.2021.05.19.12.02.35; Wed, 19 May 2021 12:02:48 -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 S234846AbhESCOL (ORCPT + 99 others); Tue, 18 May 2021 22:14:11 -0400 Received: from shelob.surriel.com ([96.67.55.147]:42456 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234810AbhESCOL (ORCPT ); Tue, 18 May 2021 22:14:11 -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.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 Sender: riel@shelob.surriel.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-+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--