Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\slab_common.c Create Date:2022-07-28 14:29:22
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:create_cache

Proto:static struct kmem_cache *create_cache(const char *name, unsigned int object_size, unsigned int align, slab_flags_t flags, unsigned int useroffset, unsigned int usersize, void (*ctor)(void *), struct mem_cgroup *memcg, struct kmem_cache *root_cache)

Type:struct kmem_cache

Parameter:

TypeParameterName
const char *name
unsigned intobject_size
unsigned intalign
slab_flags_tflags
unsigned intuseroffset
unsigned intusersize
void (*ctor
struct mem_cgroup *memcg
struct kmem_cache *root_cache
388  If WARN_ON(useroffset + usersize > object_size) Then useroffset = usersize = 0
391  err = -ENOMEM
392  s = Shortcuts
393  If Not s Then Go to out
396  Name (only for display!) = name
397  The size of an object including metadata = The size of an object without metadata = object_size
398  Alignment = align
399  ctor = ctor
400  Usercopy region offset = useroffset
401  Usercopy region size = usersize
403  err = init_memcg_params(s, root_cache)
404  If err Then Go to out_free_cache
407  err = Functions provided by the slab allocators
408  If err Then Go to out_free_cache
411  Refcount for slab cache destroy = 1
412  list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
413  memcg_link_cache(s, memcg)
414  out :
415  If err Then Return ERR_PTR(err)
417  Return s
419  out_free_cache :
420  destroy_memcg_params(s)
421  kmem_cache_free(kmem_cache, s)
422  Go to out
Caller
NameDescribe
kmem_cache_create_usercopykmem_cache_create_usercopy - Create a cache with a region suitable* for copying to userspace*@name: A string which is used in /proc/slabinfo to identify this cache.*@size: The size of objects to be created in this cache.