Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Set the process memory policy

Proto:static long do_set_mempolicy(unsigned short mode, unsigned short flags, nodemask_t *nodes)

Type:long

Parameter:

TypeParameterName
unsigned shortmode
unsigned shortflags
nodemask_t *nodes
811  NODEMASK_SCRATCH(scratch)
814  If Not scratch Then Return -ENOMEM
817  new = This function just creates a new policy, does some check and simple* initialization. You must invoke mpol_set_nodemask() to set nodes.
818  If IS_ERR(new) Then
819  ret = PTR_ERR(new)
820  Go to out
823  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.
824  ret = mpol_set_nodemask 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
825  If ret Then
826  task_unlock(current process)
827  mpol_put(new)
828  Go to out
830  old = mempolicy
831  mempolicy = new
832  If new && See MPOL_* above == MPOL_INTERLEAVE Then il_prev = MAX_NUMNODES - 1
834  task_unlock(current process)
835  mpol_put(old)
836  ret = 0
837  out :
838  NODEMASK_SCRATCH_FREE(scratch)
839  Return ret
Caller
NameDescribe
kernel_set_mempolicySet the process memory policy
numa_policy_initassumes fs == KERNEL_DS
numa_default_policyReset policy of current process to default