Re: [PATCH -next 8/9] mm: page_alloc: use a folio in free_pages_prepare()

From: David Hildenbrand
Date: Tue Sep 26 2023 - 03:50:09 EST


On 26.09.23 02:52, Kefeng Wang wrote:
The page should not a tail page in free_pages_prepare(), let's use
a folio in free_pages_prepare() to save several compound_head() calls.

Signed-off-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx>
---
mm/page_alloc.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 06be8821d833..a888b9d57751 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1070,6 +1070,7 @@ static __always_inline bool free_pages_prepare(struct page *page,
unsigned int order, fpi_t fpi_flags)
{
int bad = 0;
+ struct folio *folio = page_folio(page);

We might have higher-order pages here that are not folios (not compound pages). It looks a bit like this function really shouldn't be working with folios in the generic way, for that reason.

Wrong level of abstraction in that function.

What am I missing?

--
Cheers,

David / dhildenb