函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\slab_common.c Create Date:2022-07-27 15:54:05
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:kmem_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.

函数原型:struct kmem_cache *kmem_cache_create_usercopy(const char *name, unsigned int size, unsigned int align, slab_flags_t flags, unsigned int useroffset, unsigned int usersize, void (*ctor)(void *))

返回类型:struct kmem_cache

参数:

类型参数名称
const char *name
unsigned intsize
unsigned intalign
slab_flags_tflags
unsigned intuseroffset
unsigned intusersize
void (*ctor
460  struct kmem_cache * s = NULL
464  get_online_cpus()
465  get_online_mems()
466  memcg_get_cache_ids()
468  mutex_lock( & slab_mutex)
470  err等于kmem_cache_sanity_check(name, size)
471  如果err
472  转到:out_unlock
476  如果flags按位与Common flags permitted for kmem_cache_create 的反则
477  err等于负EINVAL
478  转到:out_unlock
487  flags与等于Common flags available with current configuration
490  如果WARN_ON(!usersize && useroffset)或WARN_ON(size < usersize || size - usersize < useroffset)则usersize等于useroffset等于0
494  如果非usersizes等于__kmem_cache_alias(name, size, align, flags, ctor)
496  如果s则转到:out_unlock
499  cache_name等于kstrdup_const - conditionally duplicate an existing const string*@s: the string to duplicate*@gfp: the GFP mask used in the kmalloc() call when allocating memory* Note: Strings allocated by kstrdup_const should be freed by kfree_const.
500  如果非cache_name
501  err等于负ENOMEM
502  转到:out_unlock
505  s等于create_cache(cache_name, size, Figure out what the alignment of the objects will be given a set of* flags, a user specified alignment and the size of the objects., flags, useroffset, usersize, ctor, NULL, NULL)
508  如果是错误
509  err等于错误
510  kfree_const - conditionally free memory*@x: pointer to the memory* Function calls kfree only if @x is not in .rodata section.
513  out_unlock :
514  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
516  memcg_put_cache_ids()
517  put_online_mems()
518  put_online_cpus()
520  如果err
521  如果flags按位与Panic if kmem_cache_create() fails panic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns.
524  否则
525  打印警告信息("kmem_cache_create(%s) failed with error %d\n", name, err)
527  dump_stack()
529  返回:NULL
531  返回:s
调用者
名称描述
proc_caches_init进程缓存初始化
uts_ns_init
kmem_cache_create创建高速缓存区
fork_init进程创建机制初始化
vfs_caches_init虚拟文件系统缓存初始化