diff options
author | Christoph Lameter <clameter@sgi.com> | 2006-09-25 23:31:50 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-26 08:48:51 -0700 |
commit | d00bcc98d7ec2c87391c9d9e1cca519ef64d33ef (patch) | |
tree | 08b7d0fafba03d7b1d4d1d861897f78658aba173 /mm/slob.c | |
parent | 39bbcb8f88154c4ac9853baf3f1134af4c987517 (diff) | |
download | linux-d00bcc98d7ec2c87391c9d9e1cca519ef64d33ef.tar.gz linux-d00bcc98d7ec2c87391c9d9e1cca519ef64d33ef.tar.bz2 linux-d00bcc98d7ec2c87391c9d9e1cca519ef64d33ef.zip |
[PATCH] Extract the allocpercpu functions from the slab allocator
The allocpercpu functions __alloc_percpu and __free_percpu() are heavily
using the slab allocator. However, they are conceptually slab. This also
simplifies SLOB (at this point slob may be broken in mm. This should fix
it).
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/slob.c')
-rw-r--r-- | mm/slob.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/mm/slob.c b/mm/slob.c index 7b52b20b9607..4c28a421b270 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -343,48 +343,3 @@ void kmem_cache_init(void) atomic_t slab_reclaim_pages = ATOMIC_INIT(0); EXPORT_SYMBOL(slab_reclaim_pages); -#ifdef CONFIG_SMP - -void *__alloc_percpu(size_t size) -{ - int i; - struct percpu_data *pdata = kmalloc(sizeof (*pdata), GFP_KERNEL); - - if (!pdata) - return NULL; - - for_each_possible_cpu(i) { - pdata->ptrs[i] = kmalloc(size, GFP_KERNEL); - if (!pdata->ptrs[i]) - goto unwind_oom; - memset(pdata->ptrs[i], 0, size); - } - - /* Catch derefs w/o wrappers */ - return (void *) (~(unsigned long) pdata); - -unwind_oom: - while (--i >= 0) { - if (!cpu_possible(i)) - continue; - kfree(pdata->ptrs[i]); - } - kfree(pdata); - return NULL; -} -EXPORT_SYMBOL(__alloc_percpu); - -void -free_percpu(const void *objp) -{ - int i; - struct percpu_data *p = (struct percpu_data *) (~(unsigned long) objp); - - for_each_possible_cpu(i) - kfree(p->ptrs[i]); - - kfree(p); -} -EXPORT_SYMBOL(free_percpu); - -#endif |