Commit 4947ed93 authored by Kefeng Wang's avatar Kefeng Wang Committed by Andrew Morton

mm: madvise: use vm_normal_folio() in madvise_free_pte_range()

There is already a vm_normal_folio(), use it to make
madvise_free_pte_range() only use a folio.

Link: https://lkml.kernel.org/r/20230112124028.16964-1-wangkefeng.wang@huawei.comSigned-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 69bbb87b
...@@ -617,7 +617,6 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr, ...@@ -617,7 +617,6 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr,
spinlock_t *ptl; spinlock_t *ptl;
pte_t *orig_pte, *pte, ptent; pte_t *orig_pte, *pte, ptent;
struct folio *folio; struct folio *folio;
struct page *page;
int nr_swap = 0; int nr_swap = 0;
unsigned long next; unsigned long next;
...@@ -658,10 +657,9 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr, ...@@ -658,10 +657,9 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr,
continue; continue;
} }
page = vm_normal_page(vma, addr, ptent); folio = vm_normal_folio(vma, addr, ptent);
if (!page || is_zone_device_page(page)) if (!folio || folio_is_zone_device(folio))
continue; continue;
folio = page_folio(page);
/* /*
* If pmd isn't transhuge but the folio is large and * If pmd isn't transhuge but the folio is large and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment