Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1260844pxm; Wed, 23 Feb 2022 22:43:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTO0UwlC2Qd49lpwAD6+Ti+8sZIyuXuyyEC6lfBNkd1D3Rzytu07JPJxcV1Gtg9/CMMII8 X-Received: by 2002:aa7:d68b:0:b0:410:97f0:d015 with SMTP id d11-20020aa7d68b000000b0041097f0d015mr926227edr.376.1645685038435; Wed, 23 Feb 2022 22:43:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645685038; cv=none; d=google.com; s=arc-20160816; b=eOgZAzsnTecuXzKlqdFzPNayv31lE4hxaq0rriLRkMVJTCfXBYHzqxEZAyWh3q8nm+ ROtY9RT46dMPo0zNBu8KgjINQdcXgYaPRJjag5lAFmW2K7HtrAXkshHHfTyxyvy9Qho6 OkMkJMZFozMOt8aRBiJ7WbDqwEbOR6BsLiuHmnt/JqDxFDBGzK9ZGPfNY/gd6scEgZOE f4Tw6NLd57DOfA6mgqwx7Ydz6cYNQJup9S5LgzvlK9Jy/7K304Yq1L/ewI0n0cXj9y5G N6jbniNjcYN5nTrL22YYOITe1WLfxecstpL0B/hXuNnZzaA+eJMLGKEJNC7qoW8gDuxB zLPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=7WWHAhC2u3Yrav5+xOTI+5uI30EbKHXrJLx3B/cdCfE=; b=KFSsAIxm+gjeRlEIznzlZYqD/QUpWCbnb9p2goy1K0ajrYcaHydbC5/BBjW6bSAelw W3eItqDzotOobQ+MnC2pIi+LLOiPpGXHBEoe9XNu8Sitp2Vo6/v4N6Yk7skykJoFJDX/ CrQoCKmINUKg6Kdx2O/APDoDg8WBRZgXm9QfrmumY+wYnFspWPFsty5ozMhjDWxeV6VY ZrXeLuLa1gUcUkxKtal+Sb8/pTtn+OFGpi4Fkn7w1IuucpS2SBHuGM6aPrAeP7GOFuXd wP/94KBrsNVHFyGsqocWNetqwthiU5lXGvH/UmMaEFOe0i7QoXXSC71obP5q/l8Vf0RZ xT/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Zxw1fP3e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k15si982462edq.55.2022.02.23.22.43.35; Wed, 23 Feb 2022 22:43:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Zxw1fP3e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230258AbiBXFgP (ORCPT + 99 others); Thu, 24 Feb 2022 00:36:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229903AbiBXFgO (ORCPT ); Thu, 24 Feb 2022 00:36:14 -0500 Received: from mail-vs1-xe31.google.com (mail-vs1-xe31.google.com [IPv6:2607:f8b0:4864:20::e31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1162F25291A for ; Wed, 23 Feb 2022 21:35:45 -0800 (PST) Received: by mail-vs1-xe31.google.com with SMTP id i27so992983vsr.10 for ; Wed, 23 Feb 2022 21:35:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7WWHAhC2u3Yrav5+xOTI+5uI30EbKHXrJLx3B/cdCfE=; b=Zxw1fP3eRF14/jcI7VdenJgTzhXoypJ0ib3zhRFpIbjr+wVwCNg00v65TATB+HmKJE rP9UfsVJh8JfLsEVwK4A9eJWX0+CBWbIzGbgfnidODFWuQaMxX8+rpw36HVTrxbu27Ya zbiuaqp2AkVJNKnUoeKihalnYmkzKCCEccK8PWmEk22e/TfJRCRepHNWgG+tsPunMO+5 DVOs99aUGm2CmZiTWtAx181idOX7NmLagvg69pR2ltDgKcTLxB1lUNNBIKipRviWXene yaRA6r3iGGGbwHFKSSPbpkCp+7V9T2tjotbYrVNcWxfzHyeIAWZVoRB7Sq3jCml7lAIk xZPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7WWHAhC2u3Yrav5+xOTI+5uI30EbKHXrJLx3B/cdCfE=; b=bQSYn36Eu887BrZcPgZm2U9ncHVrKSQ/G0mIxTX2oeXnUYIoDkX8Ihy7GQkPvyDD59 +t9Ya8zsyMCnlW1wWXQMQwIjmJmjvWh0xW7Nbkv8O4bIrQQRApQmdohDKRgy6UPMxIlG 8ae7gBk1/Vohsm9WatAUua7hLGKo8vPvcOdDW7g17gsc0vdPuFOGacF8zou1Wjc241yD lsc0SSNtwTVK4JZuvhInCMSDQWIbq6v20OOgpkEJDnqBujgpLLlZd26ysZo93fUJW8W8 rX/cA452o+sYcMN3gpg6dLBnF4SP/Jq6v+8EFr45o7X/bkjLopA8jX8i8jy0at303gvH /PgQ== X-Gm-Message-State: AOAM532+/jJpVnTHtHOVDWoZk1tYg2MYhQhdoHccoWd3lSCOjbjHV8ME DESQvz3Y11WR3w2I+4SjtXIwH/PCdVhBacBTCeyVbw== X-Received: by 2002:a05:6102:2914:b0:31b:b756:7950 with SMTP id cz20-20020a056102291400b0031bb7567950mr396078vsb.41.1645680944016; Wed, 23 Feb 2022 21:35:44 -0800 (PST) MIME-Version: 1.0 References: <20220208081902.3550911-1-yuzhao@google.com> <20220208081902.3550911-6-yuzhao@google.com> <87bkyy56nv.fsf@yhuang6-desk2.ccr.corp.intel.com> <87y2213wrl.fsf@yhuang6-desk2.ccr.corp.intel.com> <87h78p3pp2.fsf@yhuang6-desk2.ccr.corp.intel.com> <87a6eg4ywq.fsf@yhuang6-desk2.ccr.corp.intel.com> In-Reply-To: <87a6eg4ywq.fsf@yhuang6-desk2.ccr.corp.intel.com> From: Yu Zhao Date: Wed, 23 Feb 2022 22:35:32 -0700 Message-ID: Subject: Re: [PATCH v7 05/12] mm: multigenerational LRU: minimal implementation To: "Huang, Ying" Cc: Andrew Morton , Johannes Weiner , Mel Gorman , Michal Hocko , Andi Kleen , Aneesh Kumar , Barry Song <21cnbao@gmail.com>, Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Jesse Barnes , Jonathan Corbet , Linus Torvalds , Matthew Wilcox , Michael Larabel , Mike Rapoport , Rik van Riel , Vlastimil Babka , Will Deacon , Linux ARM , "open list:DOCUMENTATION" , linux-kernel , Linux-MM , Kernel Page Reclaim v2 , "the arch/x86 maintainers" , Brian Geffon , Jan Alexander Steffens , Oleksandr Natalenko , Steven Barrett , Suleiman Souhlal , Daniel Byrne , Donald Carr , =?UTF-8?Q?Holger_Hoffst=C3=A4tte?= , Konstantin Kharlamov , Shuang Zhai , Sofia Trinh Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 23, 2022 at 10:27 PM Huang, Ying wrote: > > Yu Zhao writes: > > > On Wed, Feb 23, 2022 at 8:32 PM Huang, Ying wrote: > >> > >> Yu Zhao writes: > >> > >> > On Wed, Feb 23, 2022 at 5:59 PM Huang, Ying wrote: > >> >> > >> >> Yu Zhao writes: > >> >> > >> >> > On Wed, Feb 23, 2022 at 1:28 AM Huang, Ying wrote: > >> >> >> > >> >> >> Hi, Yu, > >> >> >> > >> >> >> Yu Zhao writes: > >> >> >> > >> >> >> > To avoid confusions, the terms "promotion" and "demotion" will be > >> >> >> > applied to the multigenerational LRU, as a new convention; the terms > >> >> >> > "activation" and "deactivation" will be applied to the active/inactive > >> >> >> > LRU, as usual. > >> >> >> > >> >> >> In the memory tiering related commits and patchset, for example as follows, > >> >> >> > >> >> >> commit 668e4147d8850df32ca41e28f52c146025ca45c6 > >> >> >> Author: Yang Shi > >> >> >> Date: Thu Sep 2 14:59:19 2021 -0700 > >> >> >> > >> >> >> mm/vmscan: add page demotion counter > >> >> >> > >> >> >> https://lore.kernel.org/linux-mm/20220221084529.1052339-1-ying.huang@intel.com/ > >> >> >> > >> >> >> "demote" and "promote" is used for migrating pages between different > >> >> >> types of memory. Is it better for us to avoid overloading these words > >> >> >> too much to avoid the possible confusion? > >> >> > > >> >> > Given that LRU and migration are usually different contexts, I think > >> >> > we'd be fine, unless we want a third pair of terms. > >> >> > >> >> This is true before memory tiering is introduced. In systems with > >> >> multiple types memory (called memory tiering), LRU is used to identify > >> >> pages to be migrated to the slow memory node. Please take a look at > >> >> can_demote(), which is called in shrink_page_list(). > >> > > >> > This sounds clearly two contexts to me. Promotion/demotion (move > >> > between generations) while pages are on LRU; or promotion/demotion > >> > (migration between nodes) after pages are taken off LRU. > >> > > >> > Note that promotion/demotion are not used in function names. They are > >> > used to describe how MGLRU works, in comparison with the > >> > active/inactive LRU. Memory tiering is not within this context. > >> > >> Because we have used pgdemote_* in /proc/vmstat, "demotion_enabled" in > >> /sys/kernel/mm/numa, and will use pgpromote_* in /proc/vmstat. It seems > >> better to avoid to use promote/demote directly for MGLRU in ABI. A > >> possible solution is to use "mglru" and "promote/demote" together (such > >> as "mglru_promote_*" when it is needed? > > > > *If* it is needed. Currently there are no such plans. > > OK. > > >> >> >> > +static int get_swappiness(struct mem_cgroup *memcg) > >> >> >> > +{ > >> >> >> > + return mem_cgroup_get_nr_swap_pages(memcg) >= MIN_LRU_BATCH ? > >> >> >> > + mem_cgroup_swappiness(memcg) : 0; > >> >> >> > +} > >> >> >> > >> >> >> After we introduced demotion support in Linux kernel. The anonymous > >> >> >> pages in the fast memory node could be demoted to the slow memory node > >> >> >> via the page reclaiming mechanism as in the following commit. Can you > >> >> >> consider that too? > >> >> > > >> >> > Sure. How do I check whether there is still space on the slow node? > >> >> > >> >> You can always check the watermark of the slow node. But now, we > >> >> actually don't check that (as in demote_page_list()), instead we will > >> >> wake up kswapd of the slow node. The intended behavior is something > >> >> like, > >> >> > >> >> DRAM -> PMEM -> disk > >> > > >> > I'll look into this later -- for now, it's a low priority because > >> > there isn't much demand. I'll bump it up if anybody is interested in > >> > giving it a try. Meanwhile, please feel free to cook up something if > >> > you are interested. > >> > >> When we introduce a new feature, we shouldn't break an existing one. > >> That is, not introducing regression. I think that it is a rule? > >> > >> If my understanding were correct, MGLRU will ignore to scan anonymous > >> page list even if there's demotion target for the node. This breaks the > >> demotion feature in the upstream kernel. Right? > > > > I'm not saying this shouldn't be fixed. I'm saying it's a low priority > > until somebody is interested in using/testing it (or making it work). > > We are interested in this feature and can help to test it. That's great. I'll make sure it works in the next version.