All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] mm: madvise: use vm_normal_folio() in madvise_free_pte_range()
@ 2023-01-12 12:40 Kefeng Wang
  2023-01-12 13:16 ` Matthew Wilcox
  0 siblings, 1 reply; 2+ messages in thread
From: Kefeng Wang @ 2023-01-12 12:40 UTC (permalink / raw
  To: Andrew Morton, linux-mm; +Cc: linux-kernel, willy, vishal.moola, Kefeng Wang

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

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 mm/madvise.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/madvise.c b/mm/madvise.c
index 4561aaa0e46c..7931d2649de1 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -614,7 +614,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;
 
@@ -655,10 +654,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
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] mm: madvise: use vm_normal_folio() in madvise_free_pte_range()
  2023-01-12 12:40 [PATCH -next] mm: madvise: use vm_normal_folio() in madvise_free_pte_range() Kefeng Wang
@ 2023-01-12 13:16 ` Matthew Wilcox
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2023-01-12 13:16 UTC (permalink / raw
  To: Kefeng Wang; +Cc: Andrew Morton, linux-mm, linux-kernel, vishal.moola

On Thu, Jan 12, 2023 at 08:40:28PM +0800, Kefeng Wang wrote:
> There is already a vm_normal_folio(), use it to make
> madvise_free_pte_range() only use a folio.

In my defence, there wasn't a vm_normal_folio() at the time I modified
this function to use folios ;-)

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-12 13:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-12 12:40 [PATCH -next] mm: madvise: use vm_normal_folio() in madvise_free_pte_range() Kefeng Wang
2023-01-12 13:16 ` Matthew Wilcox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.