From: Jens Axboe <axboe@kernel.dk>
To: Pekka Enberg <penberg@iki.fi>, Jann Horn <jannh@google.com>
Cc: io-uring <io-uring@vger.kernel.org>,
Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>,
joseph qi <joseph.qi@linux.alibaba.com>,
Jiufei Xue <jiufei.xue@linux.alibaba.com>,
Pavel Begunkov <asml.silence@gmail.com>,
Christoph Lameter <cl@linux.com>,
Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH RFC} io_uring: io_kiocb alloc cache
Date: Wed, 13 May 2020 14:09:14 -0600 [thread overview]
Message-ID: <fb43ddb4-693b-5c07-775f-3142502495de@kernel.dk> (raw)
In-Reply-To: <20200513191919.GA10975@nero>
On 5/13/20 1:20 PM, Pekka Enberg wrote:
>
> Hi,
>
> On Wed, May 13, 2020 at 6:30 PM Jens Axboe <axboe@kernel.dk> wrote:
>>> I turned the quick'n dirty from the other day into something a bit
>>> more done. Would be great if someone else could run some
>>> performance testing with this, I get about a 10% boost on the pure
>>> NOP benchmark with this. But that's just on my laptop in qemu, so
>>> some real iron testing would be awesome.
>
> On 5/13/20 8:42 PM, Jann Horn wrote:> +slab allocator people
>> 10% boost compared to which allocator? Are you using CONFIG_SLUB?
>
> On Wed, May 13, 2020 at 6:30 PM Jens Axboe <axboe@kernel.dk> wrote:
>>> The idea here is to have a percpu alloc cache. There's two sets of
>>> state:
>>>
>>> 1) Requests that have IRQ completion. preempt disable is not
>>> enough there, we need to disable local irqs. This is a lot slower
>>> in certain setups, so we keep this separate.
>>>
>>> 2) No IRQ completion, we can get by with just disabling preempt.
>
> On 5/13/20 8:42 PM, Jann Horn wrote:> +slab allocator people
>> The SLUB allocator has percpu caching, too, and as long as you don't
>> enable any SLUB debugging or ASAN or such, and you're not hitting
>> any slowpath processing, it doesn't even have to disable interrupts,
>> it gets away with cmpxchg_double.
>
> The struct io_kiocb is 240 bytes. I don't see a dedicated slab for it in
> /proc/slabinfo on my machine, so it likely got merged to the kmalloc-256
> cache. This means that there's 32 objects in the per-CPU cache. Jens, on
> the other hand, made the cache much bigger:
Right, it gets merged with kmalloc-256 (and 5 others) in my testing.
> +#define IO_KIOCB_CACHE_MAX 256
>
> So I assume if someone does "perf record", they will see significant
> reduction in page allocator activity with Jens' patch. One possible way
> around that is forcing the page allocation order to be much higher. IOW,
> something like the following completely untested patch:
Now tested, I gave it a shot. This seems to bring performance to
basically what the io_uring patch does, so that's great! Again, just in
the microbenchmark test case, so freshly booted and just running the
case.
Will this patch introduce latencies or non-deterministic behavior for a
fragmented system?
--
Jens Axboe
next prev parent reply other threads:[~2020-05-13 20:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <492bb956-a670-8730-a35f-1d878c27175f@kernel.dk>
2020-05-13 17:42 ` [PATCH RFC} io_uring: io_kiocb alloc cache Jann Horn
2020-05-13 18:34 ` Jens Axboe
2020-05-13 19:20 ` Pekka Enberg
2020-05-13 20:09 ` Jens Axboe [this message]
2020-05-13 20:31 ` Pekka Enberg
2020-05-13 20:44 ` Jens Axboe
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=fb43ddb4-693b-5c07-775f-3142502495de@kernel.dk \
--to=axboe@kernel.dk \
--cc=akpm@linux-foundation.org \
--cc=asml.silence@gmail.com \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=io-uring@vger.kernel.org \
--cc=jannh@google.com \
--cc=jiufei.xue@linux.alibaba.com \
--cc=joseph.qi@linux.alibaba.com \
--cc=linux-mm@kvack.org \
--cc=penberg@iki.fi \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=xiaoguang.wang@linux.alibaba.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).