Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:kernel_migrate_pages

Proto:static int kernel_migrate_pages(pid_t pid, unsigned long maxnode, const unsigned long __user *old_nodes, const unsigned long __user *new_nodes)

Type:int

Parameter:

TypeParameterName
pid_tpid
unsigned longmaxnode
const unsigned long __user *old_nodes
const unsigned long __user *new_nodes
1478  struct mm_struct * mm = NULL
1484  NODEMASK_SCRATCH(scratch)
1486  If Not scratch Then Return -ENOMEM
1489  old = mask1
1490  new = mask2
1492  err = Copy a node mask from user space.
1493  If err Then Go to out
1496  err = Copy a node mask from user space.
1497  If err Then Go to out
1501  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
1502  task = If pid Then find_task_by_vpid(pid) Else current process
1503  If Not task Then
1504  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1505  err = -ESRCH
1506  Go to out
1508  get_task_struct(task)
1510  err = -EINVAL
1516  If Not ptrace_may_access(task, PTRACE_MODE_READ_REALCREDS) Then
1517  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1518  err = -EPERM
1519  Go to out_put
1521  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1523  task_nodes = cpuset_mems_allowed(task)
1525  If Not nodes_subset( * new, task_nodes) && Not Check operation authority Then
1526  err = -EPERM
1527  Go to out_put
1530  task_nodes = puset_mems_allowed - return mems_allowed mask from a tasks cpuset.*@tsk: pointer to task_struct from which to obtain cpuset->mems_allowed.* Description: Returns the nodemask_t mems_allowed of the cpuset* attached to the specified @tsk
1531  nodes_and( * new, * new, task_nodes)
1532  If nodes_empty( * new) Then Go to out_put
1535  err = security_task_movememory(task)
1536  If err Then Go to out_put
1539  mm = get_task_mm - acquire a reference to the task's mm* Returns %NULL if the task has no mm. Checks PF_KTHREAD (meaning* this kernel workthread has transiently adopted a user mm with use_mm,* to do its AIO) is not set and if so returns a reference to it, after
1540  put_task_struct(task)
1542  If Not mm Then
1543  err = -EINVAL
1544  Go to out
1547  err = Move pages between the two nodesets so as to preserve the physical* layout as much as possible.* Returns the number of page that could not be moved.
1550  Decrement the use count and release all resources for an mm.
1551  out :
1552  NODEMASK_SCRATCH_FREE(scratch)
1554  Return err
1556  out_put :
1557  put_task_struct(task)
1558  Go to out
Caller
NameDescribe
SYSCALL_DEFINE4
COMPAT_SYSCALL_DEFINE4