Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=364fbb29a0105863d76a1f7bbc01783a4af30a75
Commit:     364fbb29a0105863d76a1f7bbc01783a4af30a75
Parent:     6ce745ed39d35f9d547d00d406db2be7c6c175b3
Author:     Eric Dumazet <[EMAIL PROTECTED]>
AuthorDate: Sun May 6 14:49:27 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon May 7 12:12:52 2007 -0700

    SLAB: use num_possible_cpus() in enable_cpucache()
    
    The existing comment in mm/slab.c is *perfect*, so I reproduce it :
    
             /*
              * CPU bound tasks (e.g. network routing) can exhibit cpu bound
              * allocation behaviour: Most allocs on one cpu, most free 
operations
              * on another cpu. For these cases, an efficient object passing 
between
              * cpus is necessary. This is provided by a shared array. The array
              * replaces Bonwick's magazine layer.
              * On uniprocessor, it's functionally equivalent (but less 
efficient)
              * to a larger limit. Thus disabled by default.
              */
    
    As most shiped linux kernels are now compiled with CONFIG_SMP, there is no 
way
    a preprocessor #if can detect if the machine is UP or SMP. Better to use
    num_possible_cpus().
    
    This means on UP we allocate a 'size=0 shared array', to be more efficient.
    
    Another patch can later avoid the allocations of 'empty shared arrays', to
    save some memory.
    
    Signed-off-by: Eric Dumazet <[EMAIL PROTECTED]>
    Acked-by: Pekka Enberg <[EMAIL PROTECTED]>
    Acked-by: Christoph Lameter <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 mm/slab.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 21b2aef..ae440b5 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4033,10 +4033,8 @@ static int enable_cpucache(struct kmem_cache *cachep)
         * to a larger limit. Thus disabled by default.
         */
        shared = 0;
-#ifdef CONFIG_SMP
-       if (cachep->buffer_size <= PAGE_SIZE)
+       if (cachep->buffer_size <= PAGE_SIZE && num_possible_cpus() > 1)
                shared = 8;
-#endif
 
 #if DEBUG
        /*
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to