slab_common.c (72e0fe2241ce113cbba339ca8c2450b167774530) slab_common.c (67f2df3b82d091ed095d0e47e1f3a9d3e18e4e41)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Slab allocator functions that are independent of the allocator strategy
4 *
5 * (C) 2012 Christoph Lameter <cl@linux.com>
6 */
7#include <linux/slab.h>
8

--- 689 unchanged lines hidden (view full) ---

698
699size_t kmalloc_size_roundup(size_t size)
700{
701 if (size && size <= KMALLOC_MAX_CACHE_SIZE) {
702 /*
703 * The flags don't matter since size_index is common to all.
704 * Neither does the caller for just getting ->object_size.
705 */
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Slab allocator functions that are independent of the allocator strategy
4 *
5 * (C) 2012 Christoph Lameter <cl@linux.com>
6 */
7#include <linux/slab.h>
8

--- 689 unchanged lines hidden (view full) ---

698
699size_t kmalloc_size_roundup(size_t size)
700{
701 if (size && size <= KMALLOC_MAX_CACHE_SIZE) {
702 /*
703 * The flags don't matter since size_index is common to all.
704 * Neither does the caller for just getting ->object_size.
705 */
706 return kmalloc_slab(size, GFP_KERNEL, 0)->object_size;
706 return kmalloc_slab(size, NULL, GFP_KERNEL, 0)->object_size;
707 }
708
709 /* Above the smaller buckets, size is a multiple of page size. */
710 if (size && size <= KMALLOC_MAX_SIZE)
711 return PAGE_SIZE << get_order(size);
712
713 /*
714 * Return 'size' for 0 - kmalloc() returns ZERO_SIZE_PTR

--- 564 unchanged lines hidden ---
707 }
708
709 /* Above the smaller buckets, size is a multiple of page size. */
710 if (size && size <= KMALLOC_MAX_SIZE)
711 return PAGE_SIZE << get_order(size);
712
713 /*
714 * Return 'size' for 0 - kmalloc() returns ZERO_SIZE_PTR

--- 564 unchanged lines hidden ---