Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\mempolicy.c Create Date:2022-07-28 15:33:32
Last Modify:2020-03-17 22:28:11 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Replace a policy range.

Proto:static int shared_policy_replace(struct shared_policy *sp, unsigned long start, unsigned long end, struct sp_node *new)

Type:int

Parameter:

TypeParameterName
struct shared_policy *sp
unsigned longstart
unsigned longend
struct sp_node *new
2528  struct sp_node * n_new = NULL
2529  struct mempolicy * mpol_new = NULL
2530  ret = 0
2532  restart :
2533  write_lock( & lock)
2534  n = lookup first element intersecting start-end. Caller holds sp->lock for* reading or for writing
2536  When n && start < end cycle
2537  next = rb_next( & nd)
2538  If start >= start Then
2539  If end <= end Then sp_delete(sp, n)
2541  Else start = end
2543  Else
2545  If end > end Then
2546  If Not n_new Then Go to alloc_new
2549  mpol_new = policy
2550  atomic_set( & refcnt, 1)
2552  end = start
2554  n_new = NULL
2555  mpol_new = NULL
2556  Break
2557  Else end = start
2560  If Not next Then Break
2562  n = rb_entry(next, structsp_node, nd)
2564  If new Then Insert a new shared policy into the list. Caller holds sp->lock for* writing.
2566  write_unlock( & lock)
2567  ret = 0
2569  err_out :
2570  If mpol_new Then mpol_put(mpol_new)
2572  If n_new Then kmem_cache_free(sn_cache, n_new)
2575  Return ret
2577  alloc_new :
2578  write_unlock( & lock)
2579  ret = -ENOMEM
2580  n_new = kmem_cache_alloc(sn_cache, GFP_KERNEL)
2581  If Not n_new Then Go to err_out
2583  mpol_new = kmem_cache_alloc(policy_cache, GFP_KERNEL)
2584  If Not mpol_new Then Go to err_out
2586  Go to restart
Caller
NameDescribe
mpol_set_shared_policy