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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 23, 2022 at 1:47 AM Barry Song <21cnbao@xxxxxxxxx> wrote:
>
> On Sat, Mar 19, 2022 at 4:11 PM Yu Zhao <yuzhao@xxxxxxxxxx> wrote:
> >
> > On Fri, Mar 18, 2022 at 9:01 PM Barry Song <21cnbao@xxxxxxxxx> wrote:
> > >
> > > > +static int folio_inc_gen(struct lruvec *lruvec, struct folio *folio, bool reclaiming)
> > > > +{
> > > > +       unsigned long old_flags, new_flags;
> > > > +       int type = folio_is_file_lru(folio);
> > > > +       struct lru_gen_struct *lrugen = &lruvec->lrugen;
> > > > +       int new_gen, old_gen = lru_gen_from_seq(lrugen->min_seq[type]);
> > > > +
> > > > +       do {
> > > > +               new_flags = old_flags = READ_ONCE(folio->flags);
> > > > +               VM_BUG_ON_FOLIO(!(new_flags & LRU_GEN_MASK), folio);
> > > > +
> > > > +               new_gen = ((new_flags & LRU_GEN_MASK) >> LRU_GEN_PGOFF) - 1;
> > > > +               new_gen = (old_gen + 1) % MAX_NR_GENS;
> > >
> > > new_gen is assigned twice, i assume you mean
> > >                old_gen = ((new_flags & LRU_GEN_MASK) >> LRU_GEN_PGOFF) - 1;
> > >                new_gen = (old_gen + 1) % MAX_NR_GENS;
> > >
> > > or do you always mean new_gen =  lru_gen_from_seq(min_seq) + 1?
> >
> > Thanks a lot for your attention to details!
> >
> > The first line should be in the next patch but I overlooked during the
> > last refactoring:
>
> Thanks for the clarification. So an unmapped file-backed page which is
> accessed only by system call will always be in either min_seq or
> min_seq + 1? it has no chance to be in max_seq like a faulted-in
> mapped file page?

That's right. The rationale is documented here under the `Assumptions`
section [1]. This is also related to Aneesh's question about why MGLRU
doesn't need additional heuristics for VM_EXEC pages [2]. Unmapped
file pages weaken the protection of executable pages under heavy
buffered IO workloads like Java NIO.

[1] https://lore.kernel.org/linux-mm/20220309021230.721028-15-yuzhao@xxxxxxxxxx/
[2] https://lore.kernel.org/linux-mm/CAOUHufYfpiGdLSdffvzDqaD5oYFG99oDJ2xgQd2Ph77OFR5NAA@xxxxxxxxxxxxxx/




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux