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,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 95E6FC433ED for ; Fri, 21 May 2021 02:05:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1F3C46135B for ; Fri, 21 May 2021 02:05:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F3C46135B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6B92B8D0015; Thu, 20 May 2021 22:05:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 669358D0001; Thu, 20 May 2021 22:05:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4BB978D0015; Thu, 20 May 2021 22:05:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0239.hostedemail.com [216.40.44.239]) by kanga.kvack.org (Postfix) with ESMTP id 188A88D0001 for ; Thu, 20 May 2021 22:05:33 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id AE48382499A8 for ; Fri, 21 May 2021 02:05:32 +0000 (UTC) X-FDA: 78163596504.07.7B6F13E Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by imf30.hostedemail.com (Postfix) with ESMTP id 13E67E0001AF for ; Fri, 21 May 2021 02:05:29 +0000 (UTC) IronPort-SDR: KoRrbAtRJ2+dmA9DgponcLBR7+NTDzvqVLs4pgCyrCJkF5GIoKZUcydpm3FfJns+ss/t1tcTfu SoyIGZsMupFA== X-IronPort-AV: E=McAfee;i="6200,9189,9990"; a="201091126" X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="201091126" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2021 19:05:28 -0700 IronPort-SDR: ozfDnHgnfmd6Um2s85dibhgvFoBS92YBbMvNTPTJZ74PI7MLraeXnzMmwyh7L8+2+M86u29a6B j8AKOMxTOGpg== X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="440705454" Received: from yhuang6-desk1.sh.intel.com (HELO yhuang6-desk1.ccr.corp.intel.com) ([10.239.13.1]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2021 19:05:24 -0700 From: "Huang, Ying" To: Johannes Weiner Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Matthew Wilcox , Linus Torvalds , Peter Xu , Hugh Dickins , Mel Gorman , Rik van Riel , Andrea Arcangeli , Michal Hocko , Dave Hansen , Tim Chen Subject: Re: [PATCH] mm: move idle swap cache pages to the tail of LRU after COW References: <20210519013313.1274454-1-ying.huang@intel.com> <87r1i28ahm.fsf@yhuang6-desk1.ccr.corp.intel.com> <87im3e88ss.fsf@yhuang6-desk1.ccr.corp.intel.com> Date: Fri, 21 May 2021 10:05:21 +0800 In-Reply-To: (Johannes Weiner's message of "Thu, 20 May 2021 13:49:37 -0400") Message-ID: <87wnrs7sf2.fsf@yhuang6-desk1.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Rspamd-Queue-Id: 13E67E0001AF Authentication-Results: imf30.hostedemail.com; dkim=none; spf=none (imf30.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.115) smtp.mailfrom=ying.huang@intel.com; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none) X-Rspamd-Server: rspam03 X-Stat-Signature: jnqsux5hgkd6akmu7pih8khkqeo7o5xz X-HE-Tag: 1621562729-900091 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: Johannes Weiner writes: > On Thu, May 20, 2021 at 09:59:15AM +0800, Huang, Ying wrote: >> Johannes Weiner writes: >> >> > On Thu, May 20, 2021 at 09:22:45AM +0800, Huang, Ying wrote: >> >> Johannes Weiner writes: >> >> >> >> > On Wed, May 19, 2021 at 09:33:13AM +0800, Huang Ying wrote: >> >> >> diff --git a/mm/memory.c b/mm/memory.c >> >> >> index b83f734c4e1d..2b6847f4c03e 100644 >> >> >> --- a/mm/memory.c >> >> >> +++ 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); >> >> > >> >> > If there are no more swap or pte references, can we just attempt to >> >> > free the page right away, like we do during regular unmap? >> >> > >> >> > if (page_copied) >> >> > free_swap_cache(old_page); >> >> > put_page(old_page); >> >> >> >> A previous version of the patch does roughly this. >> >> >> >> https://lore.kernel.org/lkml/20210113024241.179113-1-ying.huang@intel.com/ >> >> >> >> But Linus has concerns with the overhead introduced in the hot COW path. >> > >> > Sorry, I had missed that thread. >> > >> > It sounds like there were the same concerns about the LRU shuffling >> > overhead in the COW page. Now we have numbers for that, but not the >> > free_swap_cache version. Would you be able to run the numbers for that >> > as well? It would be interesting to see how much the additional code >> > complexity buys us. >> >> The number for which workload? The workload that is used to evaluate >> this patch? > > Yeah, the pmbench one from the changelog. Sure. I have rebased the original patch that frees the idle swap cache directly and done the test. The results show that the pmbench score of freeing directly is a little better than that of moving to the tail of LRU. The pmbench score increases about 3.6%. I think this is expected, because we need to free the page finally even if we move the idle swap cache to the tail of LRU. Best Regards, Huang, Ying