Re: [PATCH v10 06/14] mm: multi-gen LRU: minimal implementation

From: Yu Zhao
Date: Fri Apr 15 2022 - 16:19:19 EST


On Fri, Apr 15, 2022 at 4:26 AM Barry Song <21cnbao@xxxxxxxxx> wrote:
>
> On Fri, Apr 15, 2022 at 8:36 AM Yu Zhao <yuzhao@xxxxxxxxxx> wrote:
> >
> > On Thu, Apr 14, 2022 at 06:03:10PM +1200, Barry Song wrote:
> > >
> > > On Thu, Apr 7, 2022 at 3:16 PM Yu Zhao <yuzhao@xxxxxxxxxx> wrote:
> > > >
> > > > +
> > > > +static int isolate_folios(struct lruvec *lruvec, struct scan_control *sc, int swappiness,
> > > > + int *type_scanned, struct list_head *list)
> > > > +{
> > > > + int i;
> > > > + int type;
> > > > + int scanned;
> > > > + int tier = -1;
> > > > + DEFINE_MIN_SEQ(lruvec);
> > > > +
> > > > + VM_BUG_ON(!seq_is_valid(lruvec));
> > > > +
> > > > + /*
> > > > + * Try to make the obvious choice first. When anon and file are both
> > > > + * available from the same generation, interpret swappiness 1 as file
> > > > + * first and 200 as anon first.
> > > > + */
> > >
> > > Has this changed the ABI of swapiness?
> >
> > No.
> >
> > > or it is only something
> > > meaningful for the internal code?
> >
> > This is how swappiness is interpreted.
> >
> > > if so, can we rename it to
> > > something else? otherwise, it is quite confusing.
> >
> > Feel free to suggest something.
> >
> > > it seems 1 is set internally as a magic number here:
> > > +static void lru_gen_shrink_lruvec(struct lruvec *lruvec, struct
> > > scan_control *sc)
> > > +{
> > > + ...
> > > + else if (!cgroup_reclaim(sc) && get_swappiness(lruvec, sc))
> > > + swappiness = 1;
> > > + else
> > > + swappiness = 0;
> > > + }
> > > obviously this swappiness is neither /proc/sys/vm/swappiness nor
> > > /sys/fs/cgroup/memory/<group>/>memory.swappiness, right?
> >
> > Right.
> >
> > > > @@ -3928,6 +4726,11 @@ static void age_active_anon(struct pglist_data *pgdat,
> > > > struct mem_cgroup *memcg;
> > > > struct lruvec *lruvec;
> > > >
> > > > + if (lru_gen_enabled()) {
> > > > + lru_gen_age_node(pgdat, sc);
> > > > + return;
> > > > + }
> > >
> > > is it really a good place for lru_gen_age_node() since the function
> > > is named age_active_anon()
> > > but here you are doing aging for both anon and file pages?
> >
> > Yes.
> >
> > > obviously
> > > lru_gen_age_node() is not
>
> > > doing "age active anon".
> >
> ;> We can rename it if you have something in mind.
>
> i wonder if we can directly do:
>
> if (lru_gen_enabled())
> lru_gen_age_node(pgdat, sc);
> else
> age_active_anon();

This looks good to me. I've queued it for the next version. Thanks.