mm/mempolicy: rename check_*range to queue_pages_*range
The function check_range() (and its family) is not well-named, because it does not only checking something, but moving pages from list to list to do page migration for them. So queue_pages_*range is more desirable name. Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com> Cc: Hillf Danton <dhillf@gmail.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Hugh Dickins <hughd@google.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Michal Hocko <mhocko@suse.cz> Cc: Rik van Riel <riel@redhat.com> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
86cdb465cf
commit
9809494578
1 changed files with 23 additions and 18 deletions
|
@ -476,8 +476,11 @@ static const struct mempolicy_operations mpol_ops[MPOL_MAX] = {
|
||||||
static void migrate_page_add(struct page *page, struct list_head *pagelist,
|
static void migrate_page_add(struct page *page, struct list_head *pagelist,
|
||||||
unsigned long flags);
|
unsigned long flags);
|
||||||
|
|
||||||
/* Scan through pages checking if pages follow certain conditions. */
|
/*
|
||||||
static int check_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
|
* Scan through pages checking if pages follow certain conditions,
|
||||||
|
* and move them to the pagelist if they do.
|
||||||
|
*/
|
||||||
|
static int queue_pages_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
|
||||||
unsigned long addr, unsigned long end,
|
unsigned long addr, unsigned long end,
|
||||||
const nodemask_t *nodes, unsigned long flags,
|
const nodemask_t *nodes, unsigned long flags,
|
||||||
void *private)
|
void *private)
|
||||||
|
@ -515,8 +518,8 @@ static int check_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
|
||||||
return addr != end;
|
return addr != end;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_hugetlb_pmd_range(struct vm_area_struct *vma, pmd_t *pmd,
|
static void queue_pages_hugetlb_pmd_range(struct vm_area_struct *vma,
|
||||||
const nodemask_t *nodes, unsigned long flags,
|
pmd_t *pmd, const nodemask_t *nodes, unsigned long flags,
|
||||||
void *private)
|
void *private)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_HUGETLB_PAGE
|
#ifdef CONFIG_HUGETLB_PAGE
|
||||||
|
@ -539,7 +542,7 @@ static void check_hugetlb_pmd_range(struct vm_area_struct *vma, pmd_t *pmd,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int check_pmd_range(struct vm_area_struct *vma, pud_t *pud,
|
static inline int queue_pages_pmd_range(struct vm_area_struct *vma, pud_t *pud,
|
||||||
unsigned long addr, unsigned long end,
|
unsigned long addr, unsigned long end,
|
||||||
const nodemask_t *nodes, unsigned long flags,
|
const nodemask_t *nodes, unsigned long flags,
|
||||||
void *private)
|
void *private)
|
||||||
|
@ -553,21 +556,21 @@ static inline int check_pmd_range(struct vm_area_struct *vma, pud_t *pud,
|
||||||
if (!pmd_present(*pmd))
|
if (!pmd_present(*pmd))
|
||||||
continue;
|
continue;
|
||||||
if (pmd_huge(*pmd) && is_vm_hugetlb_page(vma)) {
|
if (pmd_huge(*pmd) && is_vm_hugetlb_page(vma)) {
|
||||||
check_hugetlb_pmd_range(vma, pmd, nodes,
|
queue_pages_hugetlb_pmd_range(vma, pmd, nodes,
|
||||||
flags, private);
|
flags, private);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
split_huge_page_pmd(vma, addr, pmd);
|
split_huge_page_pmd(vma, addr, pmd);
|
||||||
if (pmd_none_or_trans_huge_or_clear_bad(pmd))
|
if (pmd_none_or_trans_huge_or_clear_bad(pmd))
|
||||||
continue;
|
continue;
|
||||||
if (check_pte_range(vma, pmd, addr, next, nodes,
|
if (queue_pages_pte_range(vma, pmd, addr, next, nodes,
|
||||||
flags, private))
|
flags, private))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
} while (pmd++, addr = next, addr != end);
|
} while (pmd++, addr = next, addr != end);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int check_pud_range(struct vm_area_struct *vma, pgd_t *pgd,
|
static inline int queue_pages_pud_range(struct vm_area_struct *vma, pgd_t *pgd,
|
||||||
unsigned long addr, unsigned long end,
|
unsigned long addr, unsigned long end,
|
||||||
const nodemask_t *nodes, unsigned long flags,
|
const nodemask_t *nodes, unsigned long flags,
|
||||||
void *private)
|
void *private)
|
||||||
|
@ -582,14 +585,14 @@ static inline int check_pud_range(struct vm_area_struct *vma, pgd_t *pgd,
|
||||||
continue;
|
continue;
|
||||||
if (pud_none_or_clear_bad(pud))
|
if (pud_none_or_clear_bad(pud))
|
||||||
continue;
|
continue;
|
||||||
if (check_pmd_range(vma, pud, addr, next, nodes,
|
if (queue_pages_pmd_range(vma, pud, addr, next, nodes,
|
||||||
flags, private))
|
flags, private))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
} while (pud++, addr = next, addr != end);
|
} while (pud++, addr = next, addr != end);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int check_pgd_range(struct vm_area_struct *vma,
|
static inline int queue_pages_pgd_range(struct vm_area_struct *vma,
|
||||||
unsigned long addr, unsigned long end,
|
unsigned long addr, unsigned long end,
|
||||||
const nodemask_t *nodes, unsigned long flags,
|
const nodemask_t *nodes, unsigned long flags,
|
||||||
void *private)
|
void *private)
|
||||||
|
@ -602,7 +605,7 @@ static inline int check_pgd_range(struct vm_area_struct *vma,
|
||||||
next = pgd_addr_end(addr, end);
|
next = pgd_addr_end(addr, end);
|
||||||
if (pgd_none_or_clear_bad(pgd))
|
if (pgd_none_or_clear_bad(pgd))
|
||||||
continue;
|
continue;
|
||||||
if (check_pud_range(vma, pgd, addr, next, nodes,
|
if (queue_pages_pud_range(vma, pgd, addr, next, nodes,
|
||||||
flags, private))
|
flags, private))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
} while (pgd++, addr = next, addr != end);
|
} while (pgd++, addr = next, addr != end);
|
||||||
|
@ -640,12 +643,14 @@ static unsigned long change_prot_numa(struct vm_area_struct *vma,
|
||||||
#endif /* CONFIG_ARCH_USES_NUMA_PROT_NONE */
|
#endif /* CONFIG_ARCH_USES_NUMA_PROT_NONE */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if all pages in a range are on a set of nodes.
|
* Walk through page tables and collect pages to be migrated.
|
||||||
* If pagelist != NULL then isolate pages from the LRU and
|
*
|
||||||
* put them on the pagelist.
|
* If pages found in a given range are on a set of nodes (determined by
|
||||||
|
* @nodes and @flags,) it's isolated and queued to the pagelist which is
|
||||||
|
* passed via @private.)
|
||||||
*/
|
*/
|
||||||
static struct vm_area_struct *
|
static struct vm_area_struct *
|
||||||
check_range(struct mm_struct *mm, unsigned long start, unsigned long end,
|
queue_pages_range(struct mm_struct *mm, unsigned long start, unsigned long end,
|
||||||
const nodemask_t *nodes, unsigned long flags, void *private)
|
const nodemask_t *nodes, unsigned long flags, void *private)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
@ -680,7 +685,7 @@ check_range(struct mm_struct *mm, unsigned long start, unsigned long end,
|
||||||
((flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) &&
|
((flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) &&
|
||||||
vma_migratable(vma))) {
|
vma_migratable(vma))) {
|
||||||
|
|
||||||
err = check_pgd_range(vma, start, endvma, nodes,
|
err = queue_pages_pgd_range(vma, start, endvma, nodes,
|
||||||
flags, private);
|
flags, private);
|
||||||
if (err) {
|
if (err) {
|
||||||
first = ERR_PTR(err);
|
first = ERR_PTR(err);
|
||||||
|
@ -1050,7 +1055,7 @@ static int migrate_to_node(struct mm_struct *mm, int source, int dest,
|
||||||
* space range and MPOL_MF_DISCONTIG_OK, this call can not fail.
|
* space range and MPOL_MF_DISCONTIG_OK, this call can not fail.
|
||||||
*/
|
*/
|
||||||
VM_BUG_ON(!(flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)));
|
VM_BUG_ON(!(flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)));
|
||||||
check_range(mm, mm->mmap->vm_start, mm->task_size, &nmask,
|
queue_pages_range(mm, mm->mmap->vm_start, mm->task_size, &nmask,
|
||||||
flags | MPOL_MF_DISCONTIG_OK, &pagelist);
|
flags | MPOL_MF_DISCONTIG_OK, &pagelist);
|
||||||
|
|
||||||
if (!list_empty(&pagelist)) {
|
if (!list_empty(&pagelist)) {
|
||||||
|
@ -1288,7 +1293,7 @@ static long do_mbind(unsigned long start, unsigned long len,
|
||||||
if (err)
|
if (err)
|
||||||
goto mpol_out;
|
goto mpol_out;
|
||||||
|
|
||||||
vma = check_range(mm, start, end, nmask,
|
vma = queue_pages_range(mm, start, end, nmask,
|
||||||
flags | MPOL_MF_INVERT, &pagelist);
|
flags | MPOL_MF_INVERT, &pagelist);
|
||||||
|
|
||||||
err = PTR_ERR(vma); /* maybe ... */
|
err = PTR_ERR(vma); /* maybe ... */
|
||||||
|
|
Loading…
Add table
Reference in a new issue