diff options
Diffstat (limited to 'mm/slob.c')
-rw-r--r-- | mm/slob.c | 53 |
1 files changed, 1 insertions, 52 deletions
@@ -29,7 +29,6 @@ | |||
29 | * essentially no allocation space overhead. | 29 | * essentially no allocation space overhead. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <linux/config.h> | ||
33 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
34 | #include <linux/mm.h> | 33 | #include <linux/mm.h> |
35 | #include <linux/cache.h> | 34 | #include <linux/cache.h> |
@@ -271,10 +270,9 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size, | |||
271 | } | 270 | } |
272 | EXPORT_SYMBOL(kmem_cache_create); | 271 | EXPORT_SYMBOL(kmem_cache_create); |
273 | 272 | ||
274 | int kmem_cache_destroy(struct kmem_cache *c) | 273 | void kmem_cache_destroy(struct kmem_cache *c) |
275 | { | 274 | { |
276 | slob_free(c, sizeof(struct kmem_cache)); | 275 | slob_free(c, sizeof(struct kmem_cache)); |
277 | return 0; | ||
278 | } | 276 | } |
279 | EXPORT_SYMBOL(kmem_cache_destroy); | 277 | EXPORT_SYMBOL(kmem_cache_destroy); |
280 | 278 | ||
@@ -340,52 +338,3 @@ void kmem_cache_init(void) | |||
340 | 338 | ||
341 | mod_timer(&slob_timer, jiffies + HZ); | 339 | mod_timer(&slob_timer, jiffies + HZ); |
342 | } | 340 | } |
343 | |||
344 | atomic_t slab_reclaim_pages = ATOMIC_INIT(0); | ||
345 | EXPORT_SYMBOL(slab_reclaim_pages); | ||
346 | |||
347 | #ifdef CONFIG_SMP | ||
348 | |||
349 | void *__alloc_percpu(size_t size) | ||
350 | { | ||
351 | int i; | ||
352 | struct percpu_data *pdata = kmalloc(sizeof (*pdata), GFP_KERNEL); | ||
353 | |||
354 | if (!pdata) | ||
355 | return NULL; | ||
356 | |||
357 | for_each_possible_cpu(i) { | ||
358 | pdata->ptrs[i] = kmalloc(size, GFP_KERNEL); | ||
359 | if (!pdata->ptrs[i]) | ||
360 | goto unwind_oom; | ||
361 | memset(pdata->ptrs[i], 0, size); | ||
362 | } | ||
363 | |||
364 | /* Catch derefs w/o wrappers */ | ||
365 | return (void *) (~(unsigned long) pdata); | ||
366 | |||
367 | unwind_oom: | ||
368 | while (--i >= 0) { | ||
369 | if (!cpu_possible(i)) | ||
370 | continue; | ||
371 | kfree(pdata->ptrs[i]); | ||
372 | } | ||
373 | kfree(pdata); | ||
374 | return NULL; | ||
375 | } | ||
376 | EXPORT_SYMBOL(__alloc_percpu); | ||
377 | |||
378 | void | ||
379 | free_percpu(const void *objp) | ||
380 | { | ||
381 | int i; | ||
382 | struct percpu_data *p = (struct percpu_data *) (~(unsigned long) objp); | ||
383 | |||
384 | for_each_possible_cpu(i) | ||
385 | kfree(p->ptrs[i]); | ||
386 | |||
387 | kfree(p); | ||
388 | } | ||
389 | EXPORT_SYMBOL(free_percpu); | ||
390 | |||
391 | #endif | ||