From: Jiaqi Yan <jiaqiyan@google.com>
To: linmiaohe@huawei.com, vbabka@kernel.org
Cc: osalvador@kernel.org, ljs@kernel.org, ziy@nvidia.com,
harry.yoo@oracle.com, willy@infradead.org, osalvador@suse.de,
jackmanb@google.com, hannes@cmpxchg.org,
nao.horiguchi@gmail.com, david@kernel.org,
william.roche@oracle.com, tony.luck@intel.com,
wangkefeng.wang@huawei.com, jane.chu@oracle.com,
akpm@linux-foundation.org, muchun.song@linux.dev,
liam@infradead.org, rientjes@google.com, duenwen@google.com,
jthoughton@google.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, vbabka@suse.cz, rppt@kernel.org,
shuah@kernel.org, surenb@google.com, mhocko@suse.com,
boudewijn@delta-utec.com, Jiaqi Yan <jiaqiyan@google.com>
Subject: [PATCH v7 1/3] mm/page_alloc: free_prepared_contig_range() takes fpi_t
Date: Tue, 10 Nov 2026 05:33:29 +0000 [thread overview]
Message-ID: <20261110053331.2708996-2-jiaqiyan@google.com> (raw)
In-Reply-To: <20261110053331.2708996-1-jiaqiyan@google.com>
A future commit introducing free_has_hwpoisoned() to be called within
__free_pages_prepare() will need to pass specific fpi_t flags when
freeing a contiguous range of pages. Currently,
free_prepared_contig_range() hardcodes the FPI_PREPARED flag and
does not accept any caller-provided flags.
Refactor free_prepared_contig_range() to accept an fpi_t argument.
It bitwise ORs the new argument with FPI_PREPARED when calling
into __free_frozen_pages(). Update all current invocation sites
in __free_contig_range_common() to pass FPI_NONE.
This is a preparatory commit with no functional changes.
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Jiaqi Yan <jiaqiyan@google.com>
---
mm/page_alloc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 15ff5c1feef4..93dc29480ba1 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7043,7 +7043,7 @@ void __init page_alloc_sysctl_init(void)
}
static void free_prepared_contig_range(struct page *page,
- unsigned long nr_pages)
+ unsigned long nr_pages, fpi_t fpi_flags)
{
unsigned long pfn = page_to_pfn(page);
@@ -7060,7 +7060,7 @@ static void free_prepared_contig_range(struct page *page,
* Free the chunk as a single block. Our caller has already
* called free_pages_prepare() for each order-0 page.
*/
- __free_frozen_pages(page, order, FPI_PREPARED);
+ __free_frozen_pages(page, order, fpi_flags | FPI_PREPARED);
pfn += 1UL << order;
page += 1UL << order;
@@ -7097,14 +7097,14 @@ static void __free_contig_range_common(unsigned long pfn, unsigned long nr_pages
if (!can_free) {
if (start) {
- free_prepared_contig_range(start, i - nr_start);
+ free_prepared_contig_range(start, i - nr_start, FPI_NONE);
start = NULL;
}
continue;
}
if (start && memdesc_section(&page->flags) != start_sec) {
- free_prepared_contig_range(start, i - nr_start);
+ free_prepared_contig_range(start, i - nr_start, FPI_NONE);
start = page;
nr_start = i;
start_sec = memdesc_section(&page->flags);
@@ -7116,7 +7116,7 @@ static void __free_contig_range_common(unsigned long pfn, unsigned long nr_pages
}
if (start)
- free_prepared_contig_range(start, nr_pages - nr_start);
+ free_prepared_contig_range(start, nr_pages - nr_start, FPI_NONE);
}
/**
--
2.56.0.506.g506a7eabc5-goog
next prev parent reply other threads:[~2026-11-10 5:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 5:33 [PATCH v7 0/3] Only free healthy pages in high-order folio Jiaqi Yan
2026-11-10 5:33 ` Jiaqi Yan [this message]
2026-11-10 5:33 ` [PATCH v7 2/3] mm/page_alloc: only " Jiaqi Yan
2026-11-10 5:33 ` [PATCH v7 3/3] selftests/mm: add hard memory failure anonymous HugeTLB test Jiaqi Yan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261110053331.2708996-2-jiaqiyan@google.com \
--to=jiaqiyan@google.com \
--cc=akpm@linux-foundation.org \
--cc=boudewijn@delta-utec.com \
--cc=david@kernel.org \
--cc=duenwen@google.com \
--cc=hannes@cmpxchg.org \
--cc=harry.yoo@oracle.com \
--cc=jackmanb@google.com \
--cc=jane.chu@oracle.com \
--cc=jthoughton@google.com \
--cc=liam@infradead.org \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=muchun.song@linux.dev \
--cc=nao.horiguchi@gmail.com \
--cc=osalvador@kernel.org \
--cc=osalvador@suse.de \
--cc=rientjes@google.com \
--cc=rppt@kernel.org \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=tony.luck@intel.com \
--cc=vbabka@kernel.org \
--cc=vbabka@suse.cz \
--cc=wangkefeng.wang@huawei.com \
--cc=william.roche@oracle.com \
--cc=willy@infradead.org \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®