diff options
author | Kefeng Wang <wangkefeng.wang@huawei.com> | 2023-01-12 13:40:28 +0100 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-02-03 07:33:03 +0100 |
commit | 4947ed93c23218c40fb32226b895d8733cd2e05f (patch) | |
tree | 24bf0d0817abc798e42084370e5875bd3133d3ce /mm/madvise.c | |
parent | shmem: convert shmem_write_end() to use a folio (diff) | |
download | linux-4947ed93c23218c40fb32226b895d8733cd2e05f.tar.xz linux-4947ed93c23218c40fb32226b895d8733cd2e05f.zip |
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.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/madvise.c')
-rw-r--r-- | mm/madvise.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/madvise.c b/mm/madvise.c index 5296e78dccda..92a3c6bd84c1 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -617,7 +617,6 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr, spinlock_t *ptl; pte_t *orig_pte, *pte, ptent; struct folio *folio; - struct page *page; int nr_swap = 0; unsigned long next; @@ -658,10 +657,9 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr, continue; } - page = vm_normal_page(vma, addr, ptent); - if (!page || is_zone_device_page(page)) + folio = vm_normal_folio(vma, addr, ptent); + if (!folio || folio_is_zone_device(folio)) continue; - folio = page_folio(page); /* * If pmd isn't transhuge but the folio is large and |