From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Christoph Lameter <cl@linux.com>
Cc: Joonsoo Kim <js1304@gmail.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Linux Memory Management List <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linux-Netdev <netdev@vger.kernel.org>,
Alexander Duyck <alexander.duyck@gmail.com>,
brouer@redhat.com
Subject: Re: [PATCH 7/7] slub: initial bulk free implementation
Date: Tue, 16 Jun 2015 17:52:31 +0200 [thread overview]
Message-ID: <20150616175231.427499ae@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1506161008350.3496@east.gentwo.org>
On Tue, 16 Jun 2015 10:10:25 -0500 (CDT)
Christoph Lameter <cl@linux.com> wrote:
> On Tue, 16 Jun 2015, Joonsoo Kim wrote:
>
> > So, in your test, most of objects may come from one or two slabs and your
> > algorithm is well optimized for this case. But, is this workload normal case?
>
> It is normal if the objects were bulk allocated because SLUB ensures that
> all objects are first allocated from one page before moving to another.
Yes, exactly. Maybe SLAB is different? If so, then we can handle that
in the SLAB specific bulk implementation.
> > If most of objects comes from many different slabs, bulk free API does
> > enabling/disabling interrupt very much so I guess it work worse than
> > just calling __kmem_cache_free_bulk(). Could you test this case?
>
> In case of SLAB this would be an issue since the queueing mechanism
> destroys spatial locality. This is much less an issue for SLUB.
I think Kim is worried about the cost of the enable/disable calls, when
the slowpath gets called. But it is not a problem because the cost of
local_irq_{disable,enable} is very low (total cost 7 cycles).
It is very important that everybody realizes that the save+restore
variant is very expensive, this is key:
CPU: i7-4790K CPU @ 4.00GHz
* local_irq_{disable,enable}: 7 cycles(tsc) - 1.821 ns
* local_irq_{save,restore} : 37 cycles(tsc) - 9.443 ns
Even if EVERY object need to call slowpath/__slab_free() it will be
faster than calling the fallback. Because I've demonstrated the call
this_cpu_cmpxchg_double() costs 9 cycles.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Sr. Network Kernel Developer at Red Hat
Author of http://www.iptv-analyzer.org
LinkedIn: http://www.linkedin.com/in/brouer
p.s. for comparison[1] a function call cost is 5-6 cycles, and a function
pointer call cost is 6-10 cycles, depending on CPU.
[1] https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/lib/time_bench_sample.c
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-06-16 15:52 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-15 15:51 [PATCH 0/7] slub: bulk alloc and free for slub allocator Jesper Dangaard Brouer
2015-06-15 15:51 ` [PATCH 1/7] slab: infrastructure for bulk object allocation and freeing Jesper Dangaard Brouer
2015-06-15 16:45 ` Alexander Duyck
2015-06-15 16:50 ` Christoph Lameter
2015-06-16 21:44 ` Andrew Morton
2015-06-15 15:52 ` [PATCH 2/7] slub bulk alloc: extract objects from the per cpu slab Jesper Dangaard Brouer
2015-06-16 7:21 ` Joonsoo Kim
2015-06-16 15:05 ` Christoph Lameter
2015-06-16 21:48 ` Andrew Morton
2015-06-17 6:24 ` Jesper Dangaard Brouer
2015-06-15 15:52 ` [PATCH 3/7] slub: reduce indention level in kmem_cache_alloc_bulk() Jesper Dangaard Brouer
2015-06-15 15:52 ` [PATCH 4/7] slub: fix error path bug in kmem_cache_alloc_bulk Jesper Dangaard Brouer
2015-06-16 21:51 ` Andrew Morton
2015-06-17 6:25 ` Jesper Dangaard Brouer
2015-06-15 15:52 ` [PATCH 5/7] slub: kmem_cache_alloc_bulk() move clearing outside IRQ disabled section Jesper Dangaard Brouer
2015-06-15 15:52 ` [PATCH 6/7] slub: improve bulk alloc strategy Jesper Dangaard Brouer
2015-06-15 16:36 ` Christoph Lameter
2015-06-16 21:53 ` Andrew Morton
2015-06-17 6:29 ` Jesper Dangaard Brouer
2015-06-15 15:52 ` [PATCH 7/7] slub: initial bulk free implementation Jesper Dangaard Brouer
2015-06-15 16:34 ` Christoph Lameter
2015-06-16 8:04 ` Jesper Dangaard Brouer
2015-06-15 17:04 ` Alexander Duyck
2015-06-16 7:23 ` Joonsoo Kim
2015-06-16 9:20 ` Jesper Dangaard Brouer
2015-06-16 12:00 ` Joonsoo Kim
2015-06-16 13:58 ` Jesper Dangaard Brouer
2015-06-16 15:06 ` Christoph Lameter
2015-06-16 7:28 ` Joonsoo Kim
2015-06-16 8:21 ` Jesper Dangaard Brouer
2015-06-16 8:57 ` Jesper Dangaard Brouer
2015-06-16 12:05 ` Joonsoo Kim
2015-06-16 15:10 ` Christoph Lameter
2015-06-16 15:52 ` Jesper Dangaard Brouer [this message]
2015-06-16 16:04 ` Christoph Lameter
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=20150616175231.427499ae@redhat.com \
--to=brouer@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.duyck@gmail.com \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=js1304@gmail.com \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
/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).