Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Retrieve NUMA policy

Proto:static long do_get_mempolicy(int *policy, nodemask_t *nmask, unsigned long addr, unsigned long flags)

Type:long

Parameter:

TypeParameterName
int *policy
nodemask_t *nmask
unsigned longaddr
unsigned longflags
890  mm = mm
891  struct vm_area_struct * vma = NULL
892  struct mempolicy * pol = mempolicy, * pol_refcount = NULL
894  If flags & ~( urn next IL mode instead of node mask | look up vma using address | urn allowed memories ) Then Return -EINVAL
898  If flags & urn allowed memories Then
899  If flags & (urn next IL mode instead of node mask | look up vma using address ) Then Return -EINVAL
901  policy = 0
902  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.
903  nmask = cpuset_current_mems_allowed
904  task_unlock(current process)
905  Return 0
908  If flags & look up vma using address Then
914  lock for reading
915  vma = Look up the first VMA which intersects the interval start_addr..end_addr-1,NULL if none. Assume start_addr < end_addr.
916  If Not vma Then
918  Return -EFAULT
920  If Function pointers to deal with this struct. && get_policy Then pol = get_policy(vma, addr)
922  Else pol = NUMA policy for the VMA
924  Else if addr Then Return -EINVAL
927  If Not pol Then pol = un-time system-wide default policy => local allocation
930  If flags & urn next IL mode instead of node mask Then
938  pol_refcount = pol
939  vma = NULL
940  mpol_get(pol)
941  err = lookup_node(mm, addr)
942  If err < 0 Then Go to out
944  policy = err
945  Else if pol == mempolicy && See MPOL_* above == MPOL_INTERLEAVE Then
948  Else
949  err = -EINVAL
950  Go to out
952  Else
953  policy = If pol == un-time system-wide default policy => local allocation Then MPOL_DEFAULT Else See MPOL_* above
959  policy |= See set_mempolicy() MPOL_F_* above & MPOL_MODE_FLAGS is the union of all possible optional mode flags passed to* either set_mempolicy() or mbind().
962  err = 0
963  If nmask Then
964  If mpol_store_user_nodemask(pol) Then
966  Else
973  out :
974  mpol_cond_put(pol)
975  If vma Then lease a read lock
977  If pol_refcount Then mpol_put(pol_refcount)
979  Return err
Caller
NameDescribe
kernel_get_mempolicyRetrieve NUMA policy