From: Nick Piggin <npiggin@suse.de>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: netdev@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
yanmin_zhang@linux.intel.com, David Miller <davem@davemloft.net>,
Christoph Lameter <clameter@engr.sgi.com>
Subject: Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP
Date: Mon, 3 Mar 2008 14:46:22 +0100 [thread overview]
Message-ID: <20080303134622.GD13138@wotan.suse.de> (raw)
In-Reply-To: <47CBF683.10201@cosmosbay.com>
On Mon, Mar 03, 2008 at 02:00:51PM +0100, Eric Dumazet wrote:
> Nick Piggin a écrit :
> >On Mon, Mar 03, 2008 at 10:53:52AM +0100, Eric Dumazet wrote:
> >
> >>Nick Piggin a écrit :
> >>
> >>>Use SLAB_SMP_ALIGN in a few places.
> >>>
> >>>
> >>>
> >>I dont understand why you added SLAB_SMP_ALIGN, without removing
> >>SLAB_HWCACHE_ALIGN on these places.
> >>
> >
> >Because I thought that in most of the cases, we also want some cacheline
> >alignment on UP systems as well because we care about the layout of the
> >structure WRT the cachelines for the mandatory/capacity miss cases, as
> >well as wanting to avoid false sharing misses on SMP.
> >
> >Actually I didn't think _too_ hard about them, possibly some could be
> >removed. But the problem is that these things do require careful
> >thought so I should not change them unless I have done that ;)
> >
> >I guess there are some basic guidelines -- if size is a problem (ie if
> >there can be lots of these structures), then that is going to be a
> >factor; if the total pool of objects is likely to be fairly densely
> >resident in cache, then it will start to favour dense packing rather
> >than good alignment.
> >
> >
> Well, if a kmem_cache_create() is used, this is probably because number
> of objects can be large, so kmalloc() power-of-two granularity could
> waste lot of ram.
Or because you want explicit control over alignment ;)
> But yes, you are right that SLAB_SMP_ALIGN doesnt imply SLAB_HWCACHE_ALIGN
>
> - SMP_ALIGN is a hint about false sharing (when object contains a refcnt
> for example), that is a concern only if
>
> num_possible_cpus() > 1
>
> While HWCACHE_ALIGN might be a hint saying :
> - The writer carefully designed the structure so that max performance is
> obtained when all objects starts on a cache line boundary, even on
> Uniprocessor.
Yes. In which case, we are also happy if the objects are small if they
share cachelines (so long as they are still nicely aligned, which slub
currently does not do)... unless SMP_ALIGN is set, of course.
> But I suspect some uses of HWCACHE_ALIGN are not a hint but a strong
> requirement.
>
> Maybe we need to use three flags to separate the meanings ?
>
>
> SLAB_HINT_SMP_ALIGN
> SLAB_HINT_HWCACHE_ALIGN
> SLAB_HWCACHE_ALIGN /* strong requirement that two objects dont share a
> cache line */
Possibly, but I'm beginning to prefer that strong requirements should
request the explicit alignment (they can even use cache_line_size() after
Pekka's patch to make it generic). I don't like how the name implies
that you get a guarantee, however I guess in practice people are using it
more as a hint (or because they vaguely hope it makes their code run
faster :))
So I wouldn't be adverse to a rename...
next prev parent reply other threads:[~2008-03-03 13:46 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-03 9:34 [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment Nick Piggin
2008-03-03 9:35 ` [rfc][patch 2/3] slab: introduce SMP alignment Nick Piggin
2008-03-03 19:06 ` Christoph Lameter
2008-03-03 20:03 ` Nick Piggin
2008-03-03 20:09 ` Christoph Lameter
2008-03-03 20:12 ` Nick Piggin
2008-03-03 20:17 ` Christoph Lameter
2008-03-03 20:24 ` Nick Piggin
2008-03-03 20:41 ` Pekka Enberg
2008-03-03 21:23 ` Christoph Lameter
2008-03-03 21:31 ` Christoph Lameter
2008-03-05 0:16 ` Nick Piggin
2008-03-07 4:37 ` Nick Piggin
2008-03-07 5:11 ` Christoph Lameter
2008-03-07 5:19 ` Nick Piggin
2008-03-07 5:26 ` Christoph Lameter
2008-03-07 5:37 ` Nick Piggin
2008-03-11 7:13 ` Nick Piggin
2008-03-12 6:21 ` Christoph Lameter
2008-03-03 9:36 ` [rfc][patch 3/3] use SLAB_ALIGN_SMP Nick Piggin
2008-03-03 9:53 ` Eric Dumazet
2008-03-03 12:41 ` Nick Piggin
2008-03-03 13:00 ` Eric Dumazet
2008-03-03 13:46 ` Nick Piggin [this message]
2008-03-03 13:53 ` Pekka Enberg
2008-03-03 14:15 ` Eric Dumazet
2008-03-03 19:10 ` Christoph Lameter
2008-03-03 19:09 ` Christoph Lameter
2008-03-03 20:10 ` Nick Piggin
2008-03-03 20:12 ` Christoph Lameter
2008-03-03 20:18 ` Nick Piggin
2008-03-03 21:14 ` Christoph Lameter
2008-03-03 9:44 ` [rfc][patch 1/3] slub: fix small HWCACHE_ALIGN alignment Pekka Enberg
2008-03-03 12:28 ` Nick Piggin
2008-03-03 19:08 ` Christoph Lameter
2008-03-03 20:06 ` Nick Piggin
2008-03-03 20:10 ` Christoph Lameter
2008-03-03 20:17 ` Nick Piggin
2008-03-03 21:16 ` Christoph Lameter
2008-03-03 21:30 ` Pekka Enberg
2008-03-03 21:32 ` Christoph Lameter
2008-03-03 21:35 ` Pekka Enberg
2008-03-05 0:28 ` Nick Piggin
2008-03-05 20:56 ` Christoph Lameter
2008-03-06 2:49 ` Nick Piggin
2008-03-06 22:53 ` Christoph Lameter
2008-03-07 2:04 ` Nick Piggin
2008-03-07 2:20 ` Christoph Lameter
2008-03-07 2:25 ` Nick Piggin
2008-03-07 2:27 ` Christoph Lameter
2008-03-07 2:33 ` Nick Piggin
2008-03-07 2:33 ` Christoph Lameter
2008-03-07 5:23 ` Nick Piggin
2008-03-05 0:08 ` Nick Piggin
2008-03-05 0:06 ` Nick Piggin
2008-03-05 0:10 ` David Miller
2008-03-05 21:06 ` Christoph Lameter
2008-03-06 2:57 ` Nick Piggin
2008-03-06 22:56 ` Christoph Lameter
2008-03-07 2:23 ` Nick Piggin
2008-03-07 2:26 ` Christoph Lameter
2008-03-07 2:32 ` Nick Piggin
2008-03-07 2:54 ` Christoph Lameter
2008-03-07 3:10 ` Nick Piggin
2008-03-07 3:18 ` Christoph Lameter
2008-03-07 3:22 ` Nick Piggin
2008-03-07 3:58 ` Christoph Lameter
2008-03-07 4:05 ` Nick Piggin
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=20080303134622.GD13138@wotan.suse.de \
--to=npiggin@suse.de \
--cc=clameter@engr.sgi.com \
--cc=dada1@cosmosbay.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yanmin_zhang@linux.intel.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).