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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FA93C433FE for ; Thu, 24 Feb 2022 05:35:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC9A58D0002; Thu, 24 Feb 2022 00:35:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A513F8D0001; Thu, 24 Feb 2022 00:35:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F4338D0002; Thu, 24 Feb 2022 00:35:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 61AA48D0001 for ; Thu, 24 Feb 2022 00:35:46 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E65DB61409 for ; Thu, 24 Feb 2022 05:35:45 +0000 (UTC) X-FDA: 79176561450.14.5BB16E6 Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com [209.85.217.44]) by imf09.hostedemail.com (Postfix) with ESMTP id 1E97C140003 for ; Thu, 24 Feb 2022 05:35:44 +0000 (UTC) Received: by mail-vs1-f44.google.com with SMTP id e5so982051vsg.12 for ; Wed, 23 Feb 2022 21:35:44 -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=5jAbuu0iXmzAftemQW7Zixg8GIrYTUXmGQ2SZdacKhaaBDyEktDaq+T8b42ZG1/RZ2 B4g4DzxjMR1PIfeowZhDYOaXrjRWPUHT+CEpUkX8eWq1JzlUipkmfyEENrNoiIFr4JwB qh4bb7XtC0tiVx47PDhPETAhSTMJWmlq7HQl7mCI1Y98uIKsGTFufwT9rXsdF4VRVKkF diXkicv8VSMXwGmwWqAxc9dXK7bCz1kVLBV4uVhfITGRXGb/OU900iKUKXs2P/Ljv0AG cfvT66nIcQ1udNisCSX0utFzAfk7pIRChsfb8JQWhpFvtTlLF1m4uaT5U10kCvqqYwB7 EUyg== X-Gm-Message-State: AOAM533m7lMDuvsNjG4+Vsw4bA6ZZS2/SU92a6/IKthmiPcS5B/f+Gfy KBwV2D9zI2ljk6qWte51lnzKx7FPhWQciHdZPV4uGA== X-Google-Smtp-Source: ABdhPJzIv19ZFkAGm9a7wUFfoCm24bkgs4miWsRzSszOLijZZHRHI4Zo6Ve/+i4RNDZIH9qICVbvebwjNoUYss5qmcg= 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-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 1E97C140003 X-Rspam-User: Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Zxw1fP3e; spf=pass (imf09.hostedemail.com: domain of yuzhao@google.com designates 209.85.217.44 as permitted sender) smtp.mailfrom=yuzhao@google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: 1o78mxhxrkmjnqwuhstoc75it3rjoh3c X-HE-Tag: 1645680944-112954 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 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.