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,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 E648AC433B4 for ; Thu, 20 May 2021 17:49:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4FED1613E6 for ; Thu, 20 May 2021 17:49:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FED1613E6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D2D7E8E001A; Thu, 20 May 2021 13:49:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CDD1C8D0001; Thu, 20 May 2021 13:49:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B56718E001A; Thu, 20 May 2021 13:49:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0005.hostedemail.com [216.40.44.5]) by kanga.kvack.org (Postfix) with ESMTP id 866C88D0001 for ; Thu, 20 May 2021 13:49:41 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1F383181D6051 for ; Thu, 20 May 2021 17:49:41 +0000 (UTC) X-FDA: 78162346962.22.0AD6BB0 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by imf29.hostedemail.com (Postfix) with ESMTP id E4D162D1 for ; Thu, 20 May 2021 17:49:37 +0000 (UTC) Received: by mail-qk1-f175.google.com with SMTP id 124so4754397qkh.10 for ; Thu, 20 May 2021 10:49:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wnCevUZkueOstLHW1AR+QAWLP03GYm6cWFjqEuHEYGM=; b=VltoijMDIEpRVRY9l4HbfrI7BGbonOBsac4oFYuRIH/2XzCHlXMheQcqxsyieGVmd3 RYKsDZR9DrFvtQQhrPbgzeUSR3BH8PI7JXEoIJktZJBqChWZ6ejMdKAMs0sy9MzjSM7Q MmzXyySIqsGszhgVQwbm/jjSdMitHM4MRziZO3g0djOwcNF2BG1fbGBz+mnznJGy9cyi 9hGp7ggKIdlgfdrurwa4IRkJo49fg5RkbN5APqaiSPm8FZ1yjK2ZsTFrlpLEOwqTpswy H34W0Uu8ghb6KoBH6W8EsLQKTGZ3QsT51tncEUvkrHPBbsQzU8kbswMd4Q8pCi6V1dXk 4qig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wnCevUZkueOstLHW1AR+QAWLP03GYm6cWFjqEuHEYGM=; b=Mmz4IHO3a9zKQeZfX68H0/kUDlrBmtDHc7eDJpeyv+6FYiOlcJVSdSMMYocOEeeuGi HJ+fCjNkunl6hBSZaDx/TcC6gWpjBHGqzwgg63hryCVZlb0qfAni4olBfoAhRi0matys OHlRSyisM9SJ0R9OUgPUvkkumak7rgQff2gePbbs4d0exNoz4FB1cWhA3YxgEZKqicBv xmVkjM/L9tJXqZvoys11Y1FccQcBTPAP7/jBc4Ips5Oj7/aqP2fLda9AMBHWpNP1ucId i+xOpaUljbXqE7V2TNgcTKBjinlCANZvdDbORH/K1k4n8W/UMX0hz+XK32KnSUkkom6H a/yQ== X-Gm-Message-State: AOAM532hOyIcUiy0AD16v9T2F9r6umZSySdk0BtkJOJvWaTspMmFWADW u/jMcfDVYmLzuIk8gtiNIjVSaw== X-Google-Smtp-Source: ABdhPJyFy0sHlDam4B2F9bdQUSXGtggaa+v1VdI6qA9a2zyjmzAcFwO3W53jqtukcNIc+T1Ho3fwLQ== X-Received: by 2002:a05:620a:3dd:: with SMTP id r29mr6463037qkm.468.1621532979915; Thu, 20 May 2021 10:49:39 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:3178]) by smtp.gmail.com with ESMTPSA id l4sm2384579qkp.48.2021.05.20.10.49.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 10:49:38 -0700 (PDT) Date: Thu, 20 May 2021 13:49:37 -0400 From: Johannes Weiner To: "Huang, Ying" 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 Message-ID: References: <20210519013313.1274454-1-ying.huang@intel.com> <87r1i28ahm.fsf@yhuang6-desk1.ccr.corp.intel.com> <87im3e88ss.fsf@yhuang6-desk1.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87im3e88ss.fsf@yhuang6-desk1.ccr.corp.intel.com> X-Rspamd-Queue-Id: E4D162D1 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=VltoijMD; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf29.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.175 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org X-Rspamd-Server: rspam03 X-Stat-Signature: yr1gibwo6hpayo3wsmey4fok9jpsky8h X-HE-Tag: 1621532977-694594 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: 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.