Re: [Chapter One] THP zones: the use cases of policy zones

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

 



On Tue, Mar 5, 2024 at 11:07 PM Vlastimil Babka <vbabka@xxxxxxx> wrote:
>
> On 3/5/24 09:41, Barry Song wrote:
> > We did implement similar idea in the pageblock granularity on OPPO's
> > phones by extending two special migratetypes[1]:
> >
> > * QUAD_TO_TRIP - this is mainly for 4-order mTHP allocation which can use
> > ARM64's CONT-PTE; but can rarely be splitted into 3 order to dull the pain
> > of 3-order allocation if and only if 3-order allocation has failed in both
> > normal buddy and the below TRIP_TO_QUAD.
> >
> > * TRIP_TO_QUAD - this is mainly for 4-order mTHP allocation which can use
> > ARM64's CONT-PTE; but can sometimes be splitted into 3 order to dull the
> > pain of 3-order allocation if and only if 3-order allocation has failed in
> > normal buddy.
> >
> > neither of above will be merged into 5 order or above; neither of above
> > will be splitted into 2 order or lower.
> >
> > in compaction, we will skip both of above. I am seeing one disadvantage
> > of this approach is that I have to add a separate LRU list in each
> > zone to place those mTHP folios. if mTHP and small folios are put
> > in the same LRU list, the reclamation efficiency is extremely bad.
> >
> > A separate zone, on the other hand, can avoid a separate LRU list
> > for mTHP as the new zone has its own LRU list.
>
> But we switched from per-zone to per-node LRU lists years ago?
> Is that actually a complication for the policy zones? Or does this work
> silently assume multigen lru which (IIRC) works differently?

the latter. based on the below code, i believe mglru is different
with active/inactive,

void lru_gen_init_lruvec(struct lruvec *lruvec)
{
        int i;
        int gen, type, zone;
        struct lru_gen_folio *lrugen = &lruvec->lrugen;

        lrugen->max_seq = MIN_NR_GENS + 1;
        lrugen->enabled = lru_gen_enabled();

        for (i = 0; i <= MIN_NR_GENS + 1; i++)
                lrugen->timestamps[i] = jiffies;

        for_each_gen_type_zone(gen, type, zone)
                INIT_LIST_HEAD(&lrugen->folios[gen][type][zone]);

        lruvec->mm_state.seq = MIN_NR_GENS;
}

A fundamental difference is that mglru has a different aging and
eviction mechanism,
This can synchronize the LRUs of each zone to move forward at the same
pace while
the active/inactive might be unable to compare the ages of folios across zones.

>
>
> > [1] https://github.com/OnePlusOSS/android_kernel_oneplus_sm8650/blob/oneplus/sm8650_u_14.0.0_oneplus12/mm/page_alloc.c
> >
> >>
> >> [1] https://lore.kernel.org/20240215103205.2607016-1-ryan.roberts@xxxxxxx/
> >> [2] https://lore.kernel.org/20200928175428.4110504-1-zi.yan@xxxxxxxx/
> >>
> >> Signed-off-by: Yu Zhao <yuzhao@xxxxxxxxxx>
> >

Thanks
Barry





[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