From: Aaron Lu <aaron.lu@intel.com>
To: Tariq Toukan <tariqt@mellanox.com>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>,
Saeed Mahameed <saeedm@mellanox.com>,
"pstaszewski@itcare.pl" <pstaszewski@itcare.pl>,
"eric.dumazet@gmail.com" <eric.dumazet@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"ilias.apalodimas@linaro.org" <ilias.apalodimas@linaro.org>,
"yoel@kviknet.dk" <yoel@kviknet.dk>,
"mgorman@techsingularity.net" <mgorman@techsingularity.net>
Subject: Re: Kernel 4.19 network performance - forwarding/routing normal users traffic
Date: Mon, 5 Nov 2018 16:48:47 +0800 [thread overview]
Message-ID: <20181105084846.GA6203@intel.com> (raw)
In-Reply-To: <a01c44c2-bb52-e575-62c0-e990b38bda53@mellanox.com>
On Mon, Nov 05, 2018 at 08:42:33AM +0000, Tariq Toukan wrote:
>
> On 03/11/2018 2:53 PM, Jesper Dangaard Brouer wrote:
> >
> > On Fri, 2 Nov 2018 22:20:24 +0800 Aaron Lu <aaron.lu@intel.com> wrote:
> >>
> >> I think here is a problem - order 0 pages are freed directly to buddy,
> >> bypassing per-cpu-pages. This might be the reason lock contention
> >> appeared on free path.
> >
> > OMG - you just found a significant issue with the network stacks
> > interaction with the page allocator! This explains why I could not get
> > the PCP (Per-Cpu-Pages) system to have good performance, in my
> > performance networking benchmarks. As we are basically only using the
> > alloc side of PCP, and not the free side.
> > We have spend years adding different driver level recycle tricks to
> > avoid this code path getting activated, exactly because it is rather
> > slow and problematic that we hit this zone->lock.
> >
>
> Oh! It has been behaving this way for too long.
> Good catch!
Thanks.
> >> Can someone apply below diff and see if lock contention is gone?
> >
> > I have also applied and tested this patch, and yes the lock contention
> > is gone. As mentioned is it rather difficult to hit this code path, as
> > the driver page recycle mechanism tries to hide/avoid it, but mlx5 +
> > page_pool + CPU-map recycling have a known weakness that bypass the
> > driver page recycle scheme (that I've not fixed yet). I observed a 7%
> > speedup for this micro benchmark.
> >
>
> Great news. I also have a benchmark that uses orde-r0 pages and stresses
> the zone-lock. I'll test your patch during this week.
Note this patch only helps when order-0 pages are freed through
page_frag_free().
I'll send a formal patch later.
> >
> >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> >> index e2ef1c17942f..65c0ae13215a 100644
> >> --- a/mm/page_alloc.c
> >> +++ b/mm/page_alloc.c
> >> @@ -4554,8 +4554,14 @@ void page_frag_free(void *addr)
> >> {
> >> struct page *page = virt_to_head_page(addr);
> >>
> >> - if (unlikely(put_page_testzero(page)))
> >> - __free_pages_ok(page, compound_order(page));
> >> + if (unlikely(put_page_testzero(page))) {
> >> + unsigned int order = compound_order(page);
> >> +
> >> + if (order == 0)
> >> + free_unref_page(page);
> >> + else
> >> + __free_pages_ok(page, order);
> >> + }
> >> }
> >> EXPORT_SYMBOL(page_frag_free);
> >
> > Thank you Aaron for spotting this!!!
> >
> Thanks Aaron :) !!
>
> Does it conflict with your recent work that optimizes order-0 allocation?
No it doesn't. This patch optimize code outside of zone lock(by reducing
the need to take zone lock) while my recent work optimize code inside
the zone lock :-)
next prev parent reply other threads:[~2018-11-05 18:07 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-31 21:57 Kernel 4.19 network performance - forwarding/routing normal users traffic Paweł Staszewski
2018-10-31 22:09 ` Eric Dumazet
2018-10-31 22:20 ` Paweł Staszewski
2018-10-31 22:45 ` Paweł Staszewski
2018-11-01 9:22 ` Jesper Dangaard Brouer
2018-11-01 10:34 ` Paweł Staszewski
2018-11-01 15:27 ` Aaron Lu
2018-11-01 20:23 ` Saeed Mahameed
2018-11-02 5:23 ` Aaron Lu
2018-11-02 11:40 ` Jesper Dangaard Brouer
2018-11-02 14:20 ` Aaron Lu
2018-11-02 19:02 ` Paweł Staszewski
2018-11-03 0:16 ` Paweł Staszewski
2018-11-03 12:01 ` Paweł Staszewski
2018-11-03 12:58 ` Jesper Dangaard Brouer
2018-11-03 15:23 ` Paweł Staszewski
2018-11-03 15:43 ` Paweł Staszewski
2018-11-03 12:53 ` Jesper Dangaard Brouer
2018-11-05 6:28 ` Aaron Lu
2018-11-05 9:10 ` Jesper Dangaard Brouer
2018-11-05 8:42 ` Tariq Toukan
2018-11-05 8:48 ` Aaron Lu [this message]
2018-11-01 3:37 ` David Ahern
2018-11-01 10:55 ` Jesper Dangaard Brouer
2018-11-01 13:52 ` Paweł Staszewski
2018-11-01 17:23 ` David Ahern
2018-11-01 17:30 ` Paweł Staszewski
2018-11-03 17:32 ` David Ahern
2018-11-04 0:24 ` Paweł Staszewski
2018-11-05 20:17 ` Jesper Dangaard Brouer
2018-11-08 0:59 ` Paweł Staszewski
2018-11-08 1:13 ` Paweł Staszewski
2018-11-08 14:43 ` Paweł Staszewski
2018-11-07 21:06 ` David Ahern
2018-11-08 13:33 ` Paweł Staszewski
2018-11-08 16:06 ` David Ahern
2018-11-08 16:25 ` Paweł Staszewski
2018-11-08 16:27 ` Paweł Staszewski
2018-11-08 16:32 ` David Ahern
2018-11-08 17:30 ` Paweł Staszewski
2018-11-08 18:05 ` David Ahern
2018-11-09 0:40 ` Paweł Staszewski
2018-11-09 0:42 ` David Ahern
2018-11-09 4:52 ` Saeed Mahameed
2018-11-09 7:52 ` Jesper Dangaard Brouer
2018-11-09 9:56 ` Paweł Staszewski
2018-11-09 10:20 ` Paweł Staszewski
2018-11-09 16:21 ` David Ahern
2018-11-09 19:59 ` Paweł Staszewski
2018-11-10 0:06 ` David Ahern
2018-11-10 13:18 ` Paweł Staszewski
2018-11-10 14:56 ` David Ahern
2018-11-19 21:59 ` David Ahern
2018-11-20 23:00 ` Paweł Staszewski
2018-11-01 9:50 ` Saeed Mahameed
2018-11-01 11:09 ` Paweł Staszewski
2018-11-01 16:49 ` Paweł Staszewski
2018-11-01 20:37 ` Saeed Mahameed
2018-11-01 21:18 ` Paweł Staszewski
2018-11-01 21:24 ` Paweł Staszewski
2018-11-01 21:34 ` Paweł Staszewski
2018-11-03 0:18 ` Paweł Staszewski
2018-11-08 19:12 ` Paweł Staszewski
2018-11-09 22:20 ` Paweł Staszewski
2018-11-10 19:34 ` Jesper Dangaard Brouer
2018-11-10 19:49 ` Paweł Staszewski
2018-11-10 19:56 ` Paweł Staszewski
2018-11-10 22:06 ` Jesper Dangaard Brouer
2018-11-10 22:19 ` Paweł Staszewski
2018-11-11 8:03 ` Jesper Dangaard Brouer
2018-11-11 10:26 ` Paweł Staszewski
2018-11-10 20:02 ` Paweł Staszewski
2018-11-10 21:01 ` Jesper Dangaard Brouer
2018-11-10 21:53 ` Paweł Staszewski
2018-11-10 22:04 ` Paweł Staszewski
2018-11-11 8:56 ` Jesper Dangaard Brouer
2018-11-12 19:19 ` Paweł Staszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181105084846.GA6203@intel.com \
--to=aaron.lu@intel.com \
--cc=brouer@redhat.com \
--cc=eric.dumazet@gmail.com \
--cc=ilias.apalodimas@linaro.org \
--cc=mgorman@techsingularity.net \
--cc=netdev@vger.kernel.org \
--cc=pstaszewski@itcare.pl \
--cc=saeedm@mellanox.com \
--cc=tariqt@mellanox.com \
--cc=yoel@kviknet.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).