aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/mm/slub.c b/mm/slub.c
index a18708821c1e..1b0a95d75dbb 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2467,43 +2467,6 @@ int kmem_cache_shrink(struct kmem_cache *s)
2467} 2467}
2468EXPORT_SYMBOL(kmem_cache_shrink); 2468EXPORT_SYMBOL(kmem_cache_shrink);
2469 2469
2470/**
2471 * krealloc - reallocate memory. The contents will remain unchanged.
2472 * @p: object to reallocate memory for.
2473 * @new_size: how many bytes of memory are required.
2474 * @flags: the type of memory to allocate.
2475 *
2476 * The contents of the object pointed to are preserved up to the
2477 * lesser of the new and old sizes. If @p is %NULL, krealloc()
2478 * behaves exactly like kmalloc(). If @size is 0 and @p is not a
2479 * %NULL pointer, the object pointed to is freed.
2480 */
2481void *krealloc(const void *p, size_t new_size, gfp_t flags)
2482{
2483 void *ret;
2484 size_t ks;
2485
2486 if (unlikely(!p || p == ZERO_SIZE_PTR))
2487 return kmalloc(new_size, flags);
2488
2489 if (unlikely(!new_size)) {
2490 kfree(p);
2491 return ZERO_SIZE_PTR;
2492 }
2493
2494 ks = ksize(p);
2495 if (ks >= new_size)
2496 return (void *)p;
2497
2498 ret = kmalloc(new_size, flags);
2499 if (ret) {
2500 memcpy(ret, p, min(new_size, ks));
2501 kfree(p);
2502 }
2503 return ret;
2504}
2505EXPORT_SYMBOL(krealloc);
2506
2507/******************************************************************** 2470/********************************************************************
2508 * Basic setup of slabs 2471 * Basic setup of slabs
2509 *******************************************************************/ 2472 *******************************************************************/