Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp579502pxb; Thu, 15 Apr 2021 01:21:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEm9aB6OoJRCpPbenCz47TNiBFvjwlUWFtpB4LVW3U/LtAXiYF0EWRSvv168PPcegkQHNE X-Received: by 2002:aa7:82ce:0:b029:242:deb4:9442 with SMTP id f14-20020aa782ce0000b0290242deb49442mr2170335pfn.73.1618474887358; Thu, 15 Apr 2021 01:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618474887; cv=none; d=google.com; s=arc-20160816; b=ycxgBtTqvRjV23bmjJCp32b4q25snn+l+iB4D2BrqrFgDyhoG6vsoRxtzwkPs2je2z Rmjsl7gkMky/8E37p4KfThftegVYivlFWnHzpIgVpSk6Bg63VlwuBNInKwzJ0UIPv2SU SbV1X325XYCzys2t4NzC90MoHiTiP/Vgs8QN3uccv3ZeJlmYWBqnfjQMs/aPUdtbi0XU bstHbMQihV1g1LtvGuI+3Sm7izzzJkx3slNrLF8VkOUpDySnbLwMFnIr4egbUIWv+tfw O7laNGvWps1LYH6LXDm+9Cnqv7TzxoPxB9kUfNmz+/MG0Pm0nZovZqOv9TEVxYij+3kk 8tVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=aSxE5aM2SUSMPvVkZ7kjcrI1Ta60H/qEKikX2CYxCSM=; b=tXXlbhxgNjfJYDuvsAmp7gzoMMPC2BJdZPavl1L2lyH/2pfCg98S2dAdfBFY6BDx3Y 0qzmosSIfVFMQfjDK9ebTSQGyvwN+Q7+nZrgKcGo3W3G7WHG5ajwlpbG8sBi909+/0gG 10cG0X6l08yIIAJHNBZr/tEfZOw6rb0sCBvejo0hXGWAnBxx/YzOK2kj+O1zRkqgW03R SpOT1UxwKJDubKALB+S7xR3AdwnzGrJ0/k5M+He4b0fAMY0EatfEf+W5s24FquQddWFV mcMFNCDekYmUh9SH0EoCjVXqTNS7quDnE8x9tnzHemHJxujOaPE5SApan1xkjhTgyQBd 3cMQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 21si2877791pjl.20.2021.04.15.01.21.14; Thu, 15 Apr 2021 01:21:27 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231679AbhDOIU1 (ORCPT + 99 others); Thu, 15 Apr 2021 04:20:27 -0400 Received: from mga17.intel.com ([192.55.52.151]:41923 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231483AbhDOIU0 (ORCPT ); Thu, 15 Apr 2021 04:20:26 -0400 IronPort-SDR: mfvJ8iApM7hmrz0CvwS/TtodCyto2EEKegfwdjmmjd1WLIwYUviQfFyFma4Q4jNRUGE0EQbhkH ZyY2FK2fLN4Q== X-IronPort-AV: E=McAfee;i="6200,9189,9954"; a="174915921" X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="174915921" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2021 01:20:03 -0700 IronPort-SDR: TfNJDq3moFAFzCHkvOEDK/CPLHTJL3Z1oA/NTpxQDcsf8QA3NprtYMKpTvKtuUyqYZ8Nl1NZ2x 1tYBNB7Zgdmg== X-IronPort-AV: E=Sophos;i="5.82,223,1613462400"; d="scan'208";a="522284833" Received: from yhuang6-desk1.sh.intel.com (HELO yhuang6-desk1.ccr.corp.intel.com) ([10.239.13.1]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2021 01:19:54 -0700 From: "Huang, Ying" To: Yu Zhao Cc: Rik van Riel , Dave Chinner , Jens Axboe , SeongJae Park , Linux-MM , Andrew Morton , Benjamin Manes , Dave Hansen , Hillf Danton , Johannes Weiner , Jonathan Corbet , Joonsoo Kim , Matthew Wilcox , Mel Gorman , Miaohe Lin , Michael Larabel , Michal Hocko , Michel Lespinasse , Roman Gushchin , Rong Chen , SeongJae Park , Tim Chen , Vlastimil Babka , Yang Shi , Zi Yan , linux-kernel , lkp@lists.01.org, Kernel Page Reclaim v2 , Andi Kleen Subject: Re: [PATCH v2 00/16] Multigenerational LRU Framework References: <20210413075155.32652-1-sjpark@amazon.de> <3ddd4f8a-8e51-662b-df11-a63a0e75b2bc@kernel.dk> <20210413231436.GF63242@dread.disaster.area> <20210414155130.GU3762101@tassilo.jf.intel.com> <20210415030002.GX3762101@tassilo.jf.intel.com> Date: Thu, 15 Apr 2021 16:19:52 +0800 In-Reply-To: (Yu Zhao's message of "Thu, 15 Apr 2021 01:13:13 -0600") Message-ID: <87a6q0ot7b.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Yu Zhao writes: > On Wed, Apr 14, 2021 at 9:00 PM Andi Kleen wrote: >> >> > We fall back to the rmap when it's obviously not smart to do so. There >> > is still a lot of room for improvement in this function though, i.e., >> > it should be per VMA and NUMA aware. >> >> Okay so it's more a question to tune the cross over heuristic. That >> sounds much easier than replacing everything. >> >> Of course long term it might be a problem to maintain too many >> different ways to do things, but I suppose short term it's a reasonable >> strategy. > > Hi Rik, Ying, > > Sorry for being persistent. I want to make sure we are on the same page: > > Page table scanning doesn't replace the existing rmap walk. It is > complementary and only happens when it is likely that most of the > pages on a system under pressure have been referenced, i.e., out of > *inactive* pages, by definition of the existing implementation. Under > such a condition, scanning *active* pages one by one with the rmap is > likely to cost more than scanning them all at once via page tables. > When we evict *inactive* pages, we still use the rmap and share a > common path with the existing code. > > Page table scanning falls back to the rmap walk if the page tables of > a process are apparently sparse, i.e., rss < size of the page tables. > > I should have clarified this at the very beginning of the discussion. > But it has become so natural to me and I assumed we'd all see it this > way. > > Your concern regarding the NUMA optimization is still valid, and it's > a high priority. Hi, Yu, In general, I think it's a good idea to combine the page table scanning and rmap scanning in the page reclaiming. For example, if the working-set is transitioned, we can take advantage of the fast page table scanning to identify the new working-set quickly. While we can fallback to the rmap scanning if the page table scanning doesn't help. Best Regards, Huang, Ying