[PATCH v7 05/12] mm: multigenerational LRU: minimal implementation

Yu Zhao yuzhao at google.com
Wed Feb 23 17:34:33 PST 2022


On Wed, Feb 23, 2022 at 5:59 PM Huang, Ying <ying.huang at intel.com> wrote:
>
> Yu Zhao <yuzhao at google.com> writes:
>
> > On Wed, Feb 23, 2022 at 1:28 AM Huang, Ying <ying.huang at intel.com> wrote:
> >>
> >> Hi, Yu,
> >>
> >> Yu Zhao <yuzhao at google.com> 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 <yang.shi at linux.alibaba.com>
> >> 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.

> >> > +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.



More information about the linux-arm-kernel mailing list