All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Paul Jackson <pj@sgi.com>
Cc: clameter@engr.sgi.com, akpm@osdl.org,
	linux-kernel@vger.kernel.org, nickpiggin@yahoo.com.au,
	Simon.Derr@bull.net, ak@suse.de
Subject: Re: [PATCH] Cpuset: rcu optimization of page alloc hook
Date: Wed, 14 Dec 2005 09:06:45 +0100	[thread overview]
Message-ID: <439FD295.7070102@cosmosbay.com> (raw)
In-Reply-To: <20051213142346.ccd3081a.pj@sgi.com>

Paul Jackson a écrit :
> Eric wrote:
> 
>>struct kmem_cache  itself will be about 512*8 + some bytes
>>then for each cpu a 'struct array_cache' will be allocated (count 128 bytes 
> 
> 
> Hmmm ... 'struct array_cache' looks to be about 6 integer words,
> so if that is the main per-CPU cost, the minimal cost of a slab
> cache (once created, before use) is about 24 bytes per cpu.

Nope, because struct array_cache includes a variable length table of pointers 
to hold a cache of available objects per cpu. The 'limit' (the number of 
pointer in this cache) depends on the object size.

See enable_cpucache in mm/slab.c for 'limit' determination :

         if (cachep->objsize > 131072)
                 limit = 1;
         else if (cachep->objsize > PAGE_SIZE)
                 limit = 8;
         else if (cachep->objsize > 1024)
                 limit = 24;
         else if (cachep->objsize > 256)
                 limit = 54;
         else
                 limit = 120;



Let's take an example :

grep dentry /proc/slabinfo

dentry_cache      157113 425289    224   17    1 : tunables  120   60    8 : 
slabdata  25017  25017      0


'limit' is the number following 'tunable' : 120

On a 64 bits machines, 120*sizeof(void*) = 120*8 = 960

So for small objects (<= 256 bytes), you end with a sizeof(arracy_cache) = 
1024 bytes per cpu

If 512 CPUS : 512*1024 = 512 Kbytes + all other kmem_cache structures : (If 
you have a lot of Memory Nodes, then it can be very big too)

If you know that no more than 100 objects are used in 99% of setups, then a 
dedicated cache is overkill.

> 
> But whether its 24 or 128 bytes per cpu, that's a heavier weight
> hammer than is needed here.
> 
> Time for me to learn more about rcu.
> 
> Thanks for raising this issue.
> 

You are welcome.

Eric

  parent reply	other threads:[~2005-12-14  8:06 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-11 23:31 [PATCH] Cpuset: rcu optimization of page alloc hook Paul Jackson
2005-12-12  3:29 ` Andi Kleen
2005-12-12  6:11   ` Paul Jackson
2005-12-12  6:21     ` Andi Kleen
2005-12-12  6:50       ` Paul Jackson
2005-12-12  8:49 ` Eric Dumazet
2005-12-12  8:54   ` Nick Piggin
2005-12-12  9:06     ` Eric Dumazet
2005-12-12  9:11     ` Andrew Morton
2005-12-12  9:38       ` Nick Piggin
2005-12-12 10:02   ` Paul Jackson
2005-12-12 10:12     ` Andrew Morton
2005-12-13 15:53       ` Paul Jackson
2005-12-13 16:31         ` Eric Dumazet
2005-12-13 17:42           ` Christoph Lameter
2005-12-13 17:56             ` Eric Dumazet
2005-12-13 18:07               ` Christoph Lameter
2005-12-13 21:03               ` Paul Jackson
2005-12-13 21:16                 ` Christoph Lameter
2005-12-13 21:38                 ` Eric Dumazet
2005-12-13 22:23                   ` Paul Jackson
2005-12-13 22:29                     ` Christoph Lameter
2005-12-14  3:54                     ` Paul Jackson
2005-12-14  4:02                       ` Andi Kleen
2005-12-14  4:06                         ` Paul Jackson
2005-12-14  8:06                     ` Eric Dumazet [this message]
2005-12-14  8:40                       ` Paul Jackson
2005-12-13 20:08           ` Paul Jackson
2005-12-13 20:29             ` Eric Dumazet
2005-12-13 22:35               ` Paul Jackson
2005-12-13 21:44           ` Paul Jackson
2005-12-13 17:37         ` 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=439FD295.7070102@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=Simon.Derr@bull.net \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=clameter@engr.sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=pj@sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.