Function Report

Linux Kernel (v4.4)

Source File:mm\mempolicy.c Create Date:2016-01-14 12:49:58
Last Modify:2016-01-11 07:01:32 Copyright©Brick
home page Tree
Annotate the kernelChinese

Function Name:mpol_shared_policy_init

Function:void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)

Return Type:void

Parameter:

Type Parameter NameRemarks
struct shared_policy * sp pointer to inode shared policy
struct mempolicy * mpol struct mempolicy to install

Function description: initialize shared policy for inode

2433  root = RB_ROOT
2434  Process spin lock initialization
2436  If struct mempolicy to install then
2439  NODEMASK_SCRATCH
2441  If ! Scratch field! then Go to put_mpol
2444  Describe a memory policy. = This function just creates a new policy, does some check and simple initialization. You must invoke mpol_set_nodemask() to set nodes.
2445  If IS_ERR(Describe a memory policy.) then Go to free_scratch
2448  Protects->fs,->files,->mm,->group_info,->comm, keyring subscriptions and synchronises with wait4(). Also used in procfs. Also pins the final release of task.io_context. Also protects->cpuset and->cgroup.subsys[]. And->vfork_done.
2449  is called after mpol_new() to set up the nodemask, if any, for the new policy. mpol_new() has already validated the nodes parameter with respect to the policy mode and flags. But, we need to handle an empty nodemask with MPOL_PREFERRED here.
2450  task_unlock(current process)
2451  If result of is called after mpol_new() to set up the nodemask, if any, for the new policy. mpol_new() has already validated the nodes parameter with respect to the policy mode and flags. But, we need to handle an empty nodemask with MPOL_PREFERRED here. then Go to put_new
2455  set the &pvma to 0
2456  The first byte after our end address within vm_mm. = User space process size: 3GB(default).
2457  mpol_set_shared_policy( pointer to inode shared policy, &pvma, Describe a memory policy.)
2459  put_new
2460  mpol_put(Describe a memory policy.)
2461  free_scratch
2462  NODEMASK_SCRATCH_FREE
2463  put_mpol
2464  mpol_put( struct mempolicy to install)