From: Tejun Heo <tj@kernel.org>
To: Eric Dumazet <edumazet@google.com>
Cc: Vlad Buslov <vladbu@mellanox.com>,
Dennis Zhou <dennis@kernel.org>,
Linux Kernel Network Developers <netdev@vger.kernel.org>,
Yevgeny Kliteynik <kliteyn@mellanox.com>,
Yossef Efraim <yossefe@mellanox.com>,
Maor Gottlieb <maorg@mellanox.com>
Subject: Re: tc filter insertion rate degradation
Date: Tue, 22 Jan 2019 13:18:53 -0800 [thread overview]
Message-ID: <20190122211853.GF50184@devbig004.ftw2.facebook.com> (raw)
In-Reply-To: <CANn89iKb_vW+LA-91RV=zuAqbNycPFUYW54w_S=KZ3HdcWPw6Q@mail.gmail.com>
Hello,
On Tue, Jan 22, 2019 at 09:33:10AM -0800, Eric Dumazet wrote:
> > 1) Before:
> >
> > Samples: 63K of event 'cycles:ppp', Event count (approx.): 48796480071
> > Children Self Co Shared Object Symbol
> > + 21.19% 3.38% tc [kernel.vmlinux] [k] pcpu_alloc
> > + 3.45% 0.25% tc [kernel.vmlinux] [k] pcpu_alloc_area
> >
> > 2) After:
> >
> > Samples1: 92K of event 'cycles:ppp', Event count (approx.): 71446806550
> > Children Self Co Shared Object Symbol
> > + 44.67% 3.99% tc [kernel.vmlinux] [k] pcpu_alloc
> > + 19.25% 0.22% tc [kernel.vmlinux] [k] pcpu_alloc_area
The allocator hint only remembers the max available size per chunk but
not the alignment, so depending on the allocation pattern, alignment
requirement change can lead to way more scanning per alloc attempt.
Shouldn't be too difficult to improve tho.
> I guess this is more a question for per-cpu allocator experts / maintainers ?
>
> 16-bytes alignment for 16-bytes objects sound quite reasonable [1]
>
> It also means that if your workload is mostly being able to setup /
> dismantle tc filters,
> instead of really using them, you might go back to atomics instead of
> expensive per cpu storage.
>
> (Ie optimize control path instead of data path)
>
> Thanks !
>
> [1] We even might make this generic as in :
>
> diff --git a/mm/percpu.c b/mm/percpu.c
> index 27a25bf1275b7233d28cc0b126256e0f8a2b7f4f..bbf4ad37ae893fc1da5523889dd147f046852cc7
> 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -1362,7 +1362,11 @@ static void __percpu *pcpu_alloc(size_t size,
> size_t align, bool reserved,
> */
> if (unlikely(align < PCPU_MIN_ALLOC_SIZE))
> align = PCPU_MIN_ALLOC_SIZE;
> -
> + while (align < L1_CACHE_BYTES && (align << 1) <= size) {
> + if (size % (align << 1))
> + break;
> + align <<= 1;
> + }
Percpu storage is expensive and cache line sharing tends to be less of
a problem (cuz they're per-cpu), so it is useful to support custom
alignments for tighter packing.
Thanks.
--
tejun
next prev parent reply other threads:[~2019-01-22 21:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-21 11:24 tc filter insertion rate degradation Vlad Buslov
2019-01-22 17:33 ` Eric Dumazet
2019-01-22 21:18 ` Tejun Heo [this message]
2019-01-22 22:40 ` Eric Dumazet
2019-01-24 17:21 ` Dennis Zhou
2019-01-29 19:22 ` Vlad Buslov
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=20190122211853.GF50184@devbig004.ftw2.facebook.com \
--to=tj@kernel.org \
--cc=dennis@kernel.org \
--cc=edumazet@google.com \
--cc=kliteyn@mellanox.com \
--cc=maorg@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=vladbu@mellanox.com \
--cc=yossefe@mellanox.com \
/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).