mm/mempolicy: convert queue_pages_pte_range() to queue_folios_pte_range()
This function now operates on folios associated with ptes instead of pages. This change is in preparation for the conversion of queue_pages_required() to queue_folio_required() and migrate_page_add() to migrate_folio_add(). Link: https://lkml.kernel.org/r/20230130201833.27042-4-vishal.moola@gmail.com Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> Cc: David Hildenbrand <david@redhat.com> Cc: Jane Chu <jane.chu@oracle.com> Cc: "Yin, Fengwei" <fengwei.yin@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
de1f505552
commit
3dae02bbd0
@ -491,19 +491,19 @@ unlock:
|
|||||||
* Scan through pages checking if pages follow certain conditions,
|
* Scan through pages checking if pages follow certain conditions,
|
||||||
* and move them to the pagelist if they do.
|
* and move them to the pagelist if they do.
|
||||||
*
|
*
|
||||||
* queue_pages_pte_range() has three possible return values:
|
* queue_folios_pte_range() has three possible return values:
|
||||||
* 0 - pages are placed on the right node or queued successfully, or
|
* 0 - folios are placed on the right node or queued successfully, or
|
||||||
* special page is met, i.e. zero page.
|
* special page is met, i.e. zero page.
|
||||||
* 1 - there is unmovable page, and MPOL_MF_MOVE* & MPOL_MF_STRICT were
|
* 1 - there is unmovable folio, and MPOL_MF_MOVE* & MPOL_MF_STRICT were
|
||||||
* specified.
|
* specified.
|
||||||
* -EIO - only MPOL_MF_STRICT was specified and an existing page was already
|
* -EIO - only MPOL_MF_STRICT was specified and an existing folio was already
|
||||||
* on a node that does not follow the policy.
|
* on a node that does not follow the policy.
|
||||||
*/
|
*/
|
||||||
static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
|
static int queue_folios_pte_range(pmd_t *pmd, unsigned long addr,
|
||||||
unsigned long end, struct mm_walk *walk)
|
unsigned long end, struct mm_walk *walk)
|
||||||
{
|
{
|
||||||
struct vm_area_struct *vma = walk->vma;
|
struct vm_area_struct *vma = walk->vma;
|
||||||
struct page *page;
|
struct folio *folio;
|
||||||
struct queue_pages *qp = walk->private;
|
struct queue_pages *qp = walk->private;
|
||||||
unsigned long flags = qp->flags;
|
unsigned long flags = qp->flags;
|
||||||
bool has_unmovable = false;
|
bool has_unmovable = false;
|
||||||
@ -521,16 +521,16 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
|
|||||||
for (; addr != end; pte++, addr += PAGE_SIZE) {
|
for (; addr != end; pte++, addr += PAGE_SIZE) {
|
||||||
if (!pte_present(*pte))
|
if (!pte_present(*pte))
|
||||||
continue;
|
continue;
|
||||||
page = vm_normal_page(vma, addr, *pte);
|
folio = vm_normal_folio(vma, addr, *pte);
|
||||||
if (!page || is_zone_device_page(page))
|
if (!folio || folio_is_zone_device(folio))
|
||||||
continue;
|
continue;
|
||||||
/*
|
/*
|
||||||
* vm_normal_page() filters out zero pages, but there might
|
* vm_normal_folio() filters out zero pages, but there might
|
||||||
* still be PageReserved pages to skip, perhaps in a VDSO.
|
* still be reserved folios to skip, perhaps in a VDSO.
|
||||||
*/
|
*/
|
||||||
if (PageReserved(page))
|
if (folio_test_reserved(folio))
|
||||||
continue;
|
continue;
|
||||||
if (!queue_pages_required(page, qp))
|
if (!queue_pages_required(&folio->page, qp))
|
||||||
continue;
|
continue;
|
||||||
if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) {
|
if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) {
|
||||||
/* MPOL_MF_STRICT must be specified if we get here */
|
/* MPOL_MF_STRICT must be specified if we get here */
|
||||||
@ -544,7 +544,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
|
|||||||
* temporary off LRU pages in the range. Still
|
* temporary off LRU pages in the range. Still
|
||||||
* need migrate other LRU pages.
|
* need migrate other LRU pages.
|
||||||
*/
|
*/
|
||||||
if (migrate_page_add(page, qp->pagelist, flags))
|
if (migrate_page_add(&folio->page, qp->pagelist, flags))
|
||||||
has_unmovable = true;
|
has_unmovable = true;
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
@ -704,7 +704,7 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end,
|
|||||||
|
|
||||||
static const struct mm_walk_ops queue_pages_walk_ops = {
|
static const struct mm_walk_ops queue_pages_walk_ops = {
|
||||||
.hugetlb_entry = queue_pages_hugetlb,
|
.hugetlb_entry = queue_pages_hugetlb,
|
||||||
.pmd_entry = queue_pages_pte_range,
|
.pmd_entry = queue_folios_pte_range,
|
||||||
.test_walk = queue_pages_test_walk,
|
.test_walk = queue_pages_test_walk,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user