函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\mempolicy.c Create Date:2022-07-27 17:04:11
Last Modify:2020-03-17 22:28:11 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Set the process memory policy

函数原型:static long do_set_mempolicy(unsigned short mode, unsigned short flags, nodemask_t *nodes)

返回类型:long

参数:

类型参数名称
unsigned shortmode
unsigned shortflags
nodemask_t *nodes
811  NODEMASK_SCRATCH(scratch)
814  如果非scratch则返回:负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  如果是错误
819  ret等于错误
820  转到: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  如果ret
826  task_unlock(当前进程)
827  mpol_put(new)
828  转到:out
830  old等于mempolicy
831  mempolicy等于new
832  如果newSee MPOL_* above 恒等于MPOL_INTERLEAVEil_prev等于MAX_NUMNODES减1
834  task_unlock(当前进程)
835  mpol_put(old)
836  ret等于0
837  out :
838  NODEMASK_SCRATCH_FREE(scratch)
839  返回:ret
调用者
名称描述
kernel_set_mempolicySet the process memory policy
numa_policy_init初始化NUMA的内存访问策略
numa_default_policyReset policy of current process to default