public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dipankar Sarma <dipankar@in.ibm.com>
To: Manfred Spraul <manfred@colorfullife.com>
Cc: Ravikiran G Thirumalai <kiran@in.ibm.com>,
	akpm@osdl.org, linux-kernel@vger.kernel.org,
	Robert Love <rml@tech9.net>
Subject: Re: [patch] Make slab allocator work with SLAB_MUST_HWCACHE_ALIGN
Date: Sun, 14 Sep 2003 02:28:10 +0530	[thread overview]
Message-ID: <20030913205810.GA2184@in.ibm.com> (raw)
In-Reply-To: <3F6378B0.8040606@colorfullife.com>

On Sat, Sep 13, 2003 at 10:06:08PM +0200, Manfred Spraul wrote:
> Ravikiran G Thirumalai wrote:
> >I wouldn't be using the slab at all because using slabs would mean using
> >NR_CPUs pointers and one extra dereference which is bad as we had found out
> >earlier.  But I guess slab will have to do node local allocations for
> >other applications.
> > 
> >
> Interesting. Slab internally uses lots of large per-cpu arrays. 
> Alltogether something like around 40 kB/cpu. Right now implemented with 
> NR_CPUs pointers. In the long run I'll try to switch to your allocator.
> 
> But back to the patch that started this thread: Do you still need the 
> ability to set an explicit alignment for slab allocations? If yes, then 
> I'd polish my patch, double check all kmem_cache_create callers and then 
> send the patch to akpm. Otherwise I'd wait - the patch is not a bugfix.

This is the problem - the current dynamic per-cpu allocator
(alloc_percpu()) is broken. I uses kmalloc() to allocate each
CPU's data, but kmalloc() doesn't gurantee cache line alignment
(only SLAB_HWCACHE_ALIGN). This may result in some per-CPU statistics
bouncing between CPUs specially on the ones with large L1 cache lines.

We have a number of options -

1. Force kmalloc() to strictly align on cache line boundary, but will
   result in wastage of space elsewhere (with your strict align patch)
   but alloc_percpu() will never result in cache line sharing.
2. Make alloc_percpu() use its own caches for various sizes with your
   strictly align patch. The rest of the kernel is not affected.
3. Let alloc_percpu() use its own allocator which supports NUMA
   and does not use an offset table.

#2 and #3 has less impact in the kernel and we should consider those,
IMO.

Thanks
Dipankar

  reply	other threads:[~2003-09-13 20:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-10  8:16 How reliable is SLAB_HWCACHE_ALIGN? Ravikiran G Thirumalai
2003-09-10 15:41 ` Robert Love
2003-09-11  5:54   ` Ravikiran G Thirumalai
2003-09-11 11:08     ` [patch] Make slab allocator work with SLAB_MUST_HWCACHE_ALIGN Ravikiran G Thirumalai
2003-09-11 16:19       ` Manfred Spraul
2003-09-11 21:49         ` Manfred Spraul
2003-09-12  8:59         ` Ravikiran G Thirumalai
2003-09-12  9:10           ` Arjan van de Ven
2003-09-13 20:06           ` Manfred Spraul
2003-09-13 20:58             ` Dipankar Sarma [this message]
2003-09-14  8:09             ` Ravikiran G Thirumalai
2003-09-14 13:00               ` Dipankar Sarma
2003-09-15  5:13                 ` Ravikiran G Thirumalai
     [not found] <u8mV.so.19@gated-at.bofh.it>
     [not found] ` <ufor.30e.21@gated-at.bofh.it>
     [not found]   ` <usvj.6s9.17@gated-at.bofh.it>
     [not found]     ` <uxv1.5D5.23@gated-at.bofh.it>
     [not found]       ` <uCuI.5hY.13@gated-at.bofh.it>
     [not found]         ` <uRWI.xK.5@gated-at.bofh.it>
     [not found]           ` <voSF.8l7.17@gated-at.bofh.it>
2003-09-13 22:18             ` Arnd Bergmann

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=20030913205810.GA2184@in.ibm.com \
    --to=dipankar@in.ibm.com \
    --cc=akpm@osdl.org \
    --cc=kiran@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=rml@tech9.net \
    /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