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]
Date:   Sun, 13 Mar 2022 14:36:07 -0700
From:   Eric Dumazet <edumazet@...gle.com>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     Vlastimil Babka <vbabka@...e.cz>,
        kernel test robot <oliver.sang@...el.com>,
        Mel Gorman <mgorman@...hsingularity.net>,
        0day robot <lkp@...el.com>, Michal Hocko <mhocko@...nel.org>,
        Shakeel Butt <shakeelb@...gle.com>,
        Wei Xu <weixugc@...gle.com>, Greg Thelen <gthelen@...gle.com>,
        Hugh Dickins <hughd@...gle.com>,
        David Rientjes <rientjes@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>, lkp@...ts.01.org,
        "Huang, Ying" <ying.huang@...el.com>,
        "Tang, Feng" <feng.tang@...el.com>, zhengjun.xing@...ux.intel.com,
        fengwei.yin@...el.com, Eric Dumazet <eric.dumazet@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        linux-mm <linux-mm@...ck.org>
Subject: Re: [mm/page_alloc] 8212a964ee: vm-scalability.throughput 30.5% improvement

On Sun, Mar 13, 2022 at 2:27 PM Eric Dumazet <edumazet@...gle.com> wrote:
>
> On Sun, Mar 13, 2022 at 2:18 PM Matthew Wilcox <willy@...radead.org> wrote:
> >
> > On Sun, Mar 13, 2022 at 02:10:12PM -0700, Eric Dumazet wrote:
> > > @@ -3065,6 +3062,12 @@ static int rmqueue_bulk(struct zone *zone,
> > > unsigned int order,
> > >          */
> > >         __mod_zone_page_state(zone, NR_FREE_PAGES, -(i << order));
> > >         spin_unlock(&zone->lock);
> > > +       list_for_each_entry_safe(page, tmp, list, lru) {
> > > +               if (unlikely(check_pcp_refill(page))) {
> > > +                       list_del(&page->lru);
> > > +                       allocated--;
> > > +               }
> > > +       }
> >
> > ... you'd need to adjust __mod_zone_page_state() too, right?
>
> Probably !
> This was only to show the basic idea, as I said, not even compiled or tested :)

I can test the following:

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 1804287c1b792b8aa0e964b17eb002b6b1115258..30a1abf40ea7e9104bfd24a42d9e0c8ebb152fc4
100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3024,7 +3024,9 @@ static int rmqueue_bulk(struct zone *zone,
unsigned int order,
                        unsigned long count, struct list_head *list,
                        int migratetype, unsigned int alloc_flags)
 {
+       struct page *page, *tmp;
        int i, allocated = 0;
+       int free_cma_pages = 0;

        /*
         * local_lock_irq held so equivalent to spin_lock_irqsave for
@@ -3032,14 +3034,10 @@ static int rmqueue_bulk(struct zone *zone,
unsigned int order,
         */
        spin_lock(&zone->lock);
        for (i = 0; i < count; ++i) {
-               struct page *page = __rmqueue(zone, order, migratetype,
-                                                               alloc_flags);
+               page = __rmqueue(zone, order, migratetype, alloc_flags);
                if (unlikely(page == NULL))
                        break;

-               if (unlikely(check_pcp_refill(page)))
-                       continue;
-
                /*
                 * Split buddy pages returned by expand() are received here in
                 * physical page order. The page is added to the tail of
@@ -3052,9 +3050,6 @@ static int rmqueue_bulk(struct zone *zone,
unsigned int order,
                 */
                list_add_tail(&page->lru, list);
                allocated++;
-               if (is_migrate_cma(get_pcppage_migratetype(page)))
-                       __mod_zone_page_state(zone, NR_FREE_CMA_PAGES,
-                                             -(1 << order));
        }

        /*
@@ -3065,6 +3060,16 @@ static int rmqueue_bulk(struct zone *zone,
unsigned int order,
         */
        __mod_zone_page_state(zone, NR_FREE_PAGES, -(i << order));
        spin_unlock(&zone->lock);
+       list_for_each_entry_safe(page, tmp, list, lru) {
+               if (unlikely(check_pcp_refill(page))) {
+                       list_del(&page->lru);
+                       allocated--;
+               } else if (is_migrate_cma(get_pcppage_migratetype(page))) {
+                       free_cma_pages++;
+               }
+       }
+       if (free_cma_pages)
+               __mod_zone_page_state(zone, NR_FREE_CMA_PAGES,
-(free_cma_pages << order));
        return allocated;
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ