Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\slab.c Create Date:2022-07-28 15:44:29
Last Modify:2022-05-23 17:02:55 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:__kmem_cache_create - Create a cache.*@cachep: cache management descriptor*@flags: SLAB flags* Returns a ptr to the cache on success, NULL on failure.* Cannot be called within a int, but can be interrupted.

Proto:int __kmem_cache_create(struct kmem_cache *cachep, slab_flags_t flags)

Type:int

Parameter:

TypeParameterName
struct kmem_cache *cachep
slab_flags_tflags
1962  ralign = Shouldn't this be in a header file somewhere?
1965  size = The size of an object including metadata
1988  size = @a is a power of 2 value (size, Shouldn't this be in a header file somewhere? )
1990  If flags & DEBUG: Red zone objs in a cache Then
1991  ralign = REDZONE_ALIGN
1994  size = @a is a power of 2 value (size, REDZONE_ALIGN)
1998  If ralign < Alignment Then
1999  ralign = Alignment
2002  If ralign > __alignof__(unsignedlonglong) Then flags &= ~(DEBUG: Red zone objs in a cache | DEBUG: Store the last owner for bug hunting )
2007  Alignment = ralign
2008  colour_off = cache_line_size()
2010  If colour_off < Alignment Then colour_off = Alignment
2013  If slab_is_available() Then gfp = GFP_KERNEL
2015  Else gfp = GFP_NOWAIT
2041  kasan_cache_create(cachep, & size, & flags)
2043  size = @a is a power of 2 value (size, Alignment )
2048  If FREELIST_BYTE_INDEX && size < This restriction comes from byte sized index implementation.* Page size is normally 2^12 bytes and, in this case, if we want to use* byte sized index which can represent 2^8 entries, the size of the object Then size = @a is a power of 2 value (This restriction comes from byte sized index implementation.* Page size is normally 2^12 bytes and, in this case, if we want to use* byte sized index which can represent 2^8 entries, the size of the object, Alignment )
2074  If set_objfreelist_slab_cache(cachep, size, flags) Then
2075  flags |= CFLGS_OBJFREELIST_SLAB
2076  Go to done
2079  If set_off_slab_cache(cachep, size, flags) Then
2080  flags |= CFLGS_OFF_SLAB
2081  Go to done
2084  If set_on_slab_cache(cachep, size, flags) Then Go to done
2087  Return -E2BIG
2089  done :
2090  freelist_size = num * sizeof(freelist_idx_t)
2091  Used for retrieving partial slabs, etc. = flags
2092  gfp flags to use on each alloc = __GFP_COMP
2093  If flags & Use GFP_DMA memory Then gfp flags to use on each alloc |= GFP_DMA
2095  If flags & Use GFP_DMA32 memory Then gfp flags to use on each alloc |= GFP_DMA32
2097  If flags & Objects are reclaimable Then gfp flags to use on each alloc |= DOC: Page mobility and placement hints* Page mobility and placement hints* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~* These flags provide hints about how mobile the page is
2099  The size of an object including metadata = size
2100  reciprocal_buffer_size = For a description of the algorithm please have a look at* include/linux/reciprocal_div.h
2114  If OFF_SLAB(cachep) Then
2115  freelist_cache = kmalloc_slab(freelist_size, 0u)
2119  err = setup_cpu_cache(cachep, gfp)
2120  If err Then
2121  __kmem_cache_release(cachep)
2122  Return err
2125  Return 0