lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMZfGtWurskRPG8mZ33f4qP8MNi4JKZ0RzVdRd9r9_6TdAFe2Q@mail.gmail.com>
Date:   Fri, 27 Nov 2020 23:43:33 +0800
From:   Muchun Song <songmuchun@...edance.com>
To:     Vlastimil Babka <vbabka@...e.cz>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Linux Memory Management List <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [External] Re: [PATCH] mm/page_alloc: Do not isolate redundant pageblock

On Fri, Nov 27, 2020 at 11:17 PM Vlastimil Babka <vbabka@...e.cz> wrote:
>
> On 11/27/20 3:19 PM, Muchun Song wrote:
> > Current pageblock isolation logic could isolate each pageblock individually
> > since commit d9dddbf55667 ("mm/page_alloc: prevent merging between isolated
> > and other pageblocks"). So we not need to concern about page allocator
> > merges buddies from different pageblocks and changes MIGRATE_ISOLATE to
> > some other migration type.
>
> Yeah, that should be the case now.
>
> > Signed-off-by: Muchun Song <songmuchun@...edance.com>
> > ---
> >   mm/page_alloc.c | 26 ++++++++------------------
> >   1 file changed, 8 insertions(+), 18 deletions(-)
> >
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index cefbef32bf4a..608a2c2b8ab7 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -8313,16 +8313,14 @@ struct page *has_unmovable_pages(struct zone *zone, struct page *page,
> >   }
> >
> >   #ifdef CONFIG_CONTIG_ALLOC
> > -static unsigned long pfn_max_align_down(unsigned long pfn)
> > +static unsigned long pfn_align_down(unsigned long pfn)
> >   {
> > -     return pfn & ~(max_t(unsigned long, MAX_ORDER_NR_PAGES,
> > -                          pageblock_nr_pages) - 1);
> > +     return pfn & ~(pageblock_nr_pages - 1);
> >   }
> >
> > -static unsigned long pfn_max_align_up(unsigned long pfn)
> > +static unsigned long pfn_align_up(unsigned long pfn)
> >   {
> > -     return ALIGN(pfn, max_t(unsigned long, MAX_ORDER_NR_PAGES,
> > -                             pageblock_nr_pages));
> > +     return ALIGN(pfn, pageblock_nr_pages);
> >   }
>
> How bout just removing these wrappers completely and using ALIGN and ALIGN_DOWN
> directly, as there are just two uses for each?

Sounds good to me.  Will do.

>
> >   /* [start, end) must belong to a single zone. */
> > @@ -8415,14 +8413,6 @@ int alloc_contig_range(unsigned long start, unsigned long end,
> >       INIT_LIST_HEAD(&cc.migratepages);
> >
> >       /*
> > -      * What we do here is we mark all pageblocks in range as
> > -      * MIGRATE_ISOLATE.  Because pageblock and max order pages may
> > -      * have different sizes, and due to the way page allocator
> > -      * work, we align the range to biggest of the two pages so
> > -      * that page allocator won't try to merge buddies from
> > -      * different pageblocks and change MIGRATE_ISOLATE to some
> > -      * other migration type.
> > -      *
> >        * Once the pageblocks are marked as MIGRATE_ISOLATE, we
> >        * migrate the pages from an unaligned range (ie. pages that
> >        * we are interested in).  This will put all the pages in
> > @@ -8438,8 +8428,8 @@ int alloc_contig_range(unsigned long start, unsigned long end,
> >        * put back to page allocator so that buddy can use them.
> >        */
> >
> > -     ret = start_isolate_page_range(pfn_max_align_down(start),
> > -                                    pfn_max_align_up(end), migratetype, 0);
> > +     ret = start_isolate_page_range(pfn_align_down(start), pfn_align_up(end),
> > +                                    migratetype, 0);
> >       if (ret)
> >               return ret;
> >
> > @@ -8522,8 +8512,8 @@ int alloc_contig_range(unsigned long start, unsigned long end,
> >               free_contig_range(end, outer_end - end);
> >
> >   done:
> > -     undo_isolate_page_range(pfn_max_align_down(start),
> > -                             pfn_max_align_up(end), migratetype);
> > +     undo_isolate_page_range(pfn_align_down(start), pfn_align_up(end),
> > +                             migratetype);
> >       return ret;
> >   }
> >   EXPORT_SYMBOL(alloc_contig_range);
> >
>


-- 
Yours,
Muchun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ