mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
LinuxKPI: Add kmalloc_size_roundup function
kmalloc_size_roundup reports allocation bucket size for the given size. Sponsored by: Serenity CyberSecurity, LLC MFC after: 1 week Reviewed by: manu, emaste Differential Revision: https://reviews.freebsd.org/D45841
This commit is contained in:
parent
ab6e116790
commit
ab1a5d8e2a
1 changed files with 8 additions and 0 deletions
|
|
@ -237,6 +237,14 @@ ksize(const void *ptr)
|
|||
return (malloc_usable_size(ptr));
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
kmalloc_size_roundup(size_t size)
|
||||
{
|
||||
if (unlikely(size == 0 || size == SIZE_MAX))
|
||||
return (size);
|
||||
return (malloc_size(size));
|
||||
}
|
||||
|
||||
extern struct linux_kmem_cache *linux_kmem_cache_create(const char *name,
|
||||
size_t size, size_t align, unsigned flags, linux_kmem_ctor_t *ctor);
|
||||
extern void *lkpi_kmem_cache_alloc(struct linux_kmem_cache *, gfp_t);
|
||||
|
|
|
|||
Loading…
Reference in a new issue