Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:setup_kmem_cache_node

Proto:static int setup_kmem_cache_node(struct kmem_cache *cachep, int node, gfp_t gfp, bool force_change)

Type:int

Parameter:

TypeParameterName
struct kmem_cache *cachep
intnode
gfp_tgfp
boolforce_change
923  ret = -ENOMEM
925  struct array_cache * old_shared = NULL
926  struct array_cache * new_shared = NULL
927  struct alien_cache * * new_alien = NULL
928  LIST_HEAD(list)
930  If By default on NUMA we use alien caches to stage the freeing of* objects allocated from other nodes Then
931  new_alien = alloc_alien_cache(node, limit, gfp)
932  If Not new_alien Then Go to fail
936  If shared Then
937  new_shared = alloc_arraycache(node, shared * batchcount, 0xbaadf00d, gfp)
939  If Not new_shared Then Go to fail
943  ret = init_cache_node(cachep, node, gfp)
944  If ret Then Go to fail
947  n = get_node(cachep, node)
948  spin_lock_irq( & list_lock)
949  If shared && force_change Then
950  Caller needs to acquire correct kmem_cache_node's list_lock*@list: List of detached free slabs should be freed by caller
952  avail = 0
955  If Not shared || force_change Then
956  old_shared = shared
957  shared = new_shared
958  new_shared = NULL
961  If Not alien Then
962  alien = new_alien
963  new_alien = NULL
966  spin_unlock_irq( & list_lock)
967  slabs_destroy(cachep, & list)
975  If old_shared && force_change Then Wait for a grace period to elapse. But it is illegal to invoke* synchronize_rcu() from within an RCU read-side critical section.* Therefore, any legal call to synchronize_rcu() is a quiescent
978  fail :
979  kfree(old_shared)
980  kfree(new_shared)
981  free_alien_cache(new_alien)
983  Return ret
Caller
NameDescribe
setup_kmem_cache_nodesThis initializes kmem_cache_node or resizes various caches for all nodes.