Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\migrate.c Create Date:2022-07-28 15:59:34
Last Modify:2022-05-20 09:53:13 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Migrate an array of page address onto an array of nodes and fill* the corresponding array of status.

Proto:static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, unsigned long nr_pages, const void __user *__user *pages, const int __user *nodes, int __user *status, int flags)

Type:int

Parameter:

TypeParameterName
struct mm_struct *mm
nodemask_ttask_nodes
unsigned longnr_pages
const void __user *__user *pages
const int __user *nodes
int __user *status
intflags
1596  current_node = NUMA_NO_NODE
1597  LIST_HEAD(pagelist)
1599  err = 0
1601  migrate_prep() needs to be called before we start compiling a list of pages* to be migrated using isolate_lru_page(). If scheduling work on other CPUs is* undesirable, use migrate_prep_local()
1603  When i < nr_pages cycle
1604  __user * p
1608  err = -EFAULT
1609  If Get a simple variable from user space(p, pages + i) Then Go to out_flush
1611  If Get a simple variable from user space(node, nodes + i) Then Go to out_flush
1613  addr = Architectures that support memory tagging (assigning tags to memory regions,* embedding these tags into addresses that point to these memory regions, and* checking that the memory and the pointer tags match on memory accesses)(p)
1615  err = -ENODEV
1616  If node < 0 || node >= MAX_NUMNODES Then Go to out_flush
1618  If Not node_state(node, N_MEMORY) Then Go to out_flush
1621  err = -EACCES
1622  If Not No static inline type checking - see Subtlety (1) above. (node, task_nodes) Then Go to out_flush
1625  If current_node == NUMA_NO_NODE Then
1626  current_node = node
1627  start = i
1628  Else if node != current_node Then
1630  If err Then
1639  If err > 0 Then err += nr_pages - i - 1
1641  Go to out
1644  If err Then Go to out
1646  start = i
1647  current_node = node
1654  err = Resolves the given address to a struct page, isolates it from the LRU and* puts it to the given pagelist
1657  If Not err Then
1660  If err Then Go to out_flush
1662  Continue
1663  Else if err > 0 Then
1665  Continue
1668  err = store_status(status, i, err, 1)
1669  If err Then Go to out_flush
1672  err = do_move_pages_to_node(mm, & pagelist, current_node)
1673  If err Then
1674  If err > 0 Then err += nr_pages - i - 1
1676  Go to out
1678  If i > start Then
1680  If err Then Go to out
1683  current_node = NUMA_NO_NODE
1685  out_flush :
1686  If list_empty - tests whether a list is empty*@head: the list to test. Then Return err
1690  err1 = do_move_pages_to_node(mm, & pagelist, current_node)
1698  If Not err1 Then err1 = store_status(status, start, current_node, i - start)
1700  If err >= 0 Then err = err1
1702  out :
1703  Return err
Caller
NameDescribe
kernel_move_pagesMove a list of pages in the address space of the currently executing* process.