Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp836670pxj; Thu, 20 May 2021 23:43:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxebsQE7EfwGO4Ga6EtL5uqyny9bIlmbEcN6IC4vVJzoe6sN7QwZzTZsp22vZL2wHJnG+HM X-Received: by 2002:a17:907:20a7:: with SMTP id pw7mr8849024ejb.39.1621579391563; Thu, 20 May 2021 23:43:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621579391; cv=none; d=google.com; s=arc-20160816; b=P/WVUWwIavjB0kh0GFm4mxqyyZf7zlVyX9LrlrJ9pyyjI2BIGZvzl3kdGuGvjl9U/s RGdIN8I+NRGrynEiwQWZxGpJJzvSqyUuUcetSgE8k/JKvqT+h22/qR3oBpbeuVxw9VAk XAnuzQ7jkGesKboOu/1o+N+7cYZbVUQIwfwL4VSqGaATR9ZCIFr0ejKdBXWRlu4i+EOJ JCIsEJCK4N5elweVkU/tqJ4sQk89T88HRj6s6GeBxXPgL9DPDtWwGPbCuNwF+GgfFH8B 98MPvJ7YJM9dFNySjrPT6B2sqM+fKLUak5eLdP79gjXdLr+9U6JDCr1p8iDjNaYi8Q4a zx6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wnCevUZkueOstLHW1AR+QAWLP03GYm6cWFjqEuHEYGM=; b=gAcagXeYuUt8S5IhbAzG5PzlarSp3qLgXpHOcUPHXSyzq6acf36QsC8mSdGort2JBV p6SKn/pHxnRLpO+Q1Ung4MPN4YaFKIiHahEa7ysHWc4/gapGJ1hJ2hbgph9mbVzqTZ4k yYQCo3oHR5g8lvTlnfl8ld0hNl7t8fXPTD+fJFiUfDsLmNXTL3mMZzJs9s+ZGrQk/ZaK LGoWU/TPz87hkuNEY0wIe1oeg+IBtmzRagUlSMbuWB0jXdqAT86HyL8fTfk04x7O1bZm WptsPO0c/p1ECq5Zn9Qw1mmZsQsxlF/t6g82cAwdtBQdYTS03eM7d8QZvo6sf+d9zqsn M5Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=VltoijMD; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w3si4425662edt.165.2021.05.20.23.42.48; Thu, 20 May 2021 23:43:11 -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; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=VltoijMD; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234556AbhETRvD (ORCPT + 99 others); Thu, 20 May 2021 13:51:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232346AbhETRvC (ORCPT ); Thu, 20 May 2021 13:51:02 -0400 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAB1AC061574 for ; Thu, 20 May 2021 10:49:40 -0700 (PDT) Received: by mail-qk1-x731.google.com with SMTP id 76so17014470qkn.13 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=lBaCJlNlzmYYw86v4BYDKL915Z9Miv1c0RU12YVQvpOsJoyeHBMIkJ0BItoLFA2Mj4 05SRday+eI6eziFjO4ClD24o9Bu3sDWBrVpbcWvds4z6IoEXv7D8T8INH5D9GUeF2QWT g6j8+vPbANdJzIKsuLClPlGk8ZqGISWUhIjciENBV5z3PsiOvHklzicAEC47oCf/7TAN P5ySejxw1S7Ev1AwR2b4k/bTa1RpHUplAWw2PdTlPFXhmEwy5M+eNxCsDDWj47gyw7sy mcHzOtyu+LV/3SqVrNeEuIDr6RkGh918mBHwVhSOCfI/7Alb4F51IOWOzLhj0+G5BkuE llyg== X-Gm-Message-State: AOAM530SvWljjMH9stWpRl2R3dyJ8/twevgSeuRsgam/2yaKajnGBKxU RGovMDmw2fT6W4OGElKUTm2h6w== 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.