Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1217610pxm; Wed, 23 Feb 2022 21:31:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJykcCqMq3bzzTl0PziUmH31ilzwDTw9n8741OscEUSM+I5I2AU5ECkTgEYfJ1xfWzpwITRY X-Received: by 2002:a17:907:2a54:b0:6d5:879d:aca4 with SMTP id fe20-20020a1709072a5400b006d5879daca4mr889528ejc.29.1645680702184; Wed, 23 Feb 2022 21:31:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645680702; cv=none; d=google.com; s=arc-20160816; b=Ku/fozTKNSyJpcBlRBKgroDYlHycMQruMxdwVm7D0bzH0LHvb8hQ3P5WsbLWy9jLMB dKp0POIHvd1s5SV+b1e/4urGNJPTQFZHcTa0U8Fqqfxu6BregMulfA3vdzvbzNouwo01 d/PI0Z+Wt12RCMBE6KlbTVEisvunc1XTIU/OMvkqAxLeyc0yYQob/h/g6NyW7+OabmIt ifKrTtbwGK4I5tgCzAYu3WpMbqMP5bpX7gG+qcE3atDwlKbjByZhqiYsaf9JzhMOAeyy sH+kxr9rxu5DMqzUsrHDKyOrQ7yFwBZcq9qNlS4izNRaQGXy8E4C0pCQLuSNJMMbYxkx 2hvw== 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:dkim-signature; bh=sGBUHm/QioTywM/V2rjshBzJ9BicQf7gjRmxcCvXd/s=; b=RM53zTUZmHKiq5OKTOV4Zl5p8KTD8CvntHc12QQIwbhDqd8dD2JYJzNfMiVmdCu560 MDUWILPOy8y+jT+8RYkgNvOXr58juBDRZdkcA1m9PvIkf/MM+I2sdBbVxZES1BCT5IoD LbfoxYgKTCp+o8IqABCJPgD6vNZha33cXJ4G3j9j0VpMGybat6Rz45yJOSPYcv+l+Qnp t1E4i2fr2Tyb20M8UWvYRwXqfnvrpbU9NQgZODSEhov3OpOafZL4ZlVjc4Ckrt+2IeU9 rT3SU/kqsE3Jt8PB0W1DxasdyUkPXd3miyLDtwuPOgyGZEGHSTIHmIyBELKGIjMcLfZb EtJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cMdsh0w5; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb25si1275184ejc.225.2022.02.23.21.31.18; Wed, 23 Feb 2022 21:31:42 -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=@intel.com header.s=Intel header.b=cMdsh0w5; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230217AbiBXF2O (ORCPT + 99 others); Thu, 24 Feb 2022 00:28:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230041AbiBXF2M (ORCPT ); Thu, 24 Feb 2022 00:28:12 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA41816E7C6; Wed, 23 Feb 2022 21:27:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645680463; x=1677216463; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=YVsT259EOLtTsjN4BQ2T1bm1qt//VIAGtHU+4hwOobI=; b=cMdsh0w5NKZboo0OQ0PyHU4vLBjEWXk0wQzc0HNRnLFdD9oSyKJeQoRN a4tQwLXmppvEpKaJR0TuLvDlwkUE/JBH04V7gLCx0c0Fuu9J54ktKqKQQ p24mz2D3wloqwDGif2J1ZU4bzkPCkCV/02yBuAHXVsUhqgbxJUfNunLIM 5Usta0VD/6QtjfWYtxw4a3zJnP5SxM46hf6iy+LU1HEpGJNvJf8ioZV+C HaL4oCcUMuXV6/KuFGhcc2dfiCgNx6p3jrq1VOMIZEOIBsAcz3JKg8I9s pz90qS1vuhcFge/I8TNuI5Kqxxuof9HVsDFxCmUnLjIMHrk5chojhJzEN w==; X-IronPort-AV: E=McAfee;i="6200,9189,10267"; a="315379731" X-IronPort-AV: E=Sophos;i="5.88,393,1635231600"; d="scan'208";a="315379731" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2022 21:27:42 -0800 X-IronPort-AV: E=Sophos;i="5.88,393,1635231600"; d="scan'208";a="684160350" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.239.13.11]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2022 21:27:35 -0800 From: "Huang, Ying" To: Yu Zhao 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 , Holger =?utf-8?Q?Hoffst=C3=A4tte?= , Konstantin Kharlamov , Shuang Zhai , Sofia Trinh Subject: Re: [PATCH v7 05/12] mm: multigenerational LRU: minimal implementation 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> Date: Thu, 24 Feb 2022 13:27:33 +0800 In-Reply-To: (Yu Zhao's message of "Wed, 23 Feb 2022 21:09:56 -0700") Message-ID: <87a6eg4ywq.fsf@yhuang6-desk2.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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 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. > Regarding regressions, I'm sure MGLRU *will* regress many workloads. > Its goal is to improve the majority of use cases, i.e., total net > gain. Trying to improve everything is methodically wrong because the > problem space is near infinite but the resource is limited. So we have > to prioritize major use cases over minor ones. The bottom line is > users have a choice not to use MGLRU. This is a functionality regression, not performance regression. Without demotion support, some workloads will go OOM when DRAM is used up (while PMEM isn't) if PMEM is onlined in movable zone (as recommended). >> It's a new feature to check whether there is still space on the slow >> node. We can look at that later. > > SGTM. Best Regards, Huang, Ying