Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Copy a node mask from user space.

Proto:static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask, unsigned long maxnode)

Type:int

Parameter:

TypeParameterName
nodemask_t *nodes
const unsigned long __user *nmask
unsigned longmaxnode
1350  --maxnode
1351  nodes_clear( * nodes)
1352  If maxnode == 0 || Not nmask Then Return 0
1354  If maxnode > PAGE_SIZE * BITS_PER_BYTE Then Return -EINVAL
1357  nlongs = BITS_TO_LONGS(maxnode)
1358  If maxnode % BITS_PER_LONG == 0 Then endmask = ~0UL
1360  Else endmask = (1UL << maxnode % BITS_PER_LONG ) - 1
1372  If nlongs > BITS_TO_LONGS(MAX_NUMNODES) Then
1373  When k < nlongs cycle
1376  If k == nlongs - 1 Then
1377  If t & endmask Then Return -EINVAL
1379  Else if t Then Return -EINVAL
1382  nlongs = BITS_TO_LONGS(MAX_NUMNODES)
1383  endmask = ~0UL
1386  If maxnode > MAX_NUMNODES && MAX_NUMNODES % BITS_PER_LONG != 0 Then
1387  valid_mask = endmask
1389  valid_mask &= ~((1UL << MAX_NUMNODES % BITS_PER_LONG ) - 1)
1390  If Get a simple variable from user space(t, nmask + nlongs - 1) Then Return -EFAULT
1392  If t & valid_mask Then Return -EINVAL
1396  If copy_from_user(nodes_addr( * nodes), nmask, nlongs * sizeof(unsignedlong)) Then Return -EFAULT
1398  nodes_addr( * nodes)[nlongs - 1] &= endmask
1399  Return 0
Caller
NameDescribe
kernel_mbind
kernel_set_mempolicySet the process memory policy
kernel_migrate_pages