* [PATCH] mm/page_alloc: cleanup flag vars in alloc_pages_bulk_noprof()
@ 2026-03-31 10:52 Brendan Jackman
2026-03-31 16:10 ` Suren Baghdasaryan
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Brendan Jackman @ 2026-03-31 10:52 UTC (permalink / raw)
To: Andrew Morton, Vlastimil Babka, Suren Baghdasaryan, Michal Hocko,
Johannes Weiner, Zi Yan
Cc: linux-mm, linux-kernel, Brendan Jackman
These two variables are redundant, squash them to align
alloc_pages_bulk_noprof() with the style used in
alloc_frozen_pages_nolock_noprof().
Signed-off-by: Brendan Jackman <jackmanb@google.com>
---
mm/page_alloc.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 111b54df8a3cb..5e280ded6e7ac 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5051,7 +5051,6 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
struct per_cpu_pages *pcp;
struct list_head *pcp_list;
struct alloc_context ac;
- gfp_t alloc_gfp;
unsigned int alloc_flags = ALLOC_WMARK_LOW;
int nr_populated = 0, nr_account = 0;
@@ -5092,10 +5091,8 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
/* May set ALLOC_NOFRAGMENT, fragmentation will return 1 page. */
gfp &= gfp_allowed_mask;
- alloc_gfp = gfp;
- if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags))
+ if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &gfp, &alloc_flags))
goto out;
- gfp = alloc_gfp;
/* Find an allowed local zone that meets the low watermark. */
z = ac.preferred_zoneref;
---
base-commit: 57e5b07deacb0a9bd7b8c9b933ff72e902d4f06b
change-id: 20260331-b4-prepare_alloc_pages-flags-5bb9a1e04e00
Best regards,
--
Brendan Jackman <jackmanb@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/page_alloc: cleanup flag vars in alloc_pages_bulk_noprof()
2026-03-31 10:52 [PATCH] mm/page_alloc: cleanup flag vars in alloc_pages_bulk_noprof() Brendan Jackman
@ 2026-03-31 16:10 ` Suren Baghdasaryan
2026-04-01 17:11 ` Vishal Moola
2026-04-01 17:14 ` Vlastimil Babka (SUSE)
2026-04-02 2:29 ` Anshuman Khandual
2 siblings, 1 reply; 5+ messages in thread
From: Suren Baghdasaryan @ 2026-03-31 16:10 UTC (permalink / raw)
To: Brendan Jackman
Cc: Andrew Morton, Vlastimil Babka, Michal Hocko, Johannes Weiner,
Zi Yan, linux-mm, linux-kernel
On Tue, Mar 31, 2026 at 3:52 AM Brendan Jackman <jackmanb@google.com> wrote:
>
> These two variables are redundant, squash them to align
> alloc_pages_bulk_noprof() with the style used in
> alloc_frozen_pages_nolock_noprof().
Indeed. I'm not sure why this was needed even in the original patch
(387ba26fb1cb) that introduced this function. It carefully preserves
the original gfp even though its value either gets overwritten later
(prepare_alloc_pages succeeds) or is unused (prepare_alloc_pages
fails)...
>
> Signed-off-by: Brendan Jackman <jackmanb@google.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
> ---
> mm/page_alloc.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 111b54df8a3cb..5e280ded6e7ac 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5051,7 +5051,6 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
> struct per_cpu_pages *pcp;
> struct list_head *pcp_list;
> struct alloc_context ac;
> - gfp_t alloc_gfp;
> unsigned int alloc_flags = ALLOC_WMARK_LOW;
> int nr_populated = 0, nr_account = 0;
>
> @@ -5092,10 +5091,8 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
>
> /* May set ALLOC_NOFRAGMENT, fragmentation will return 1 page. */
> gfp &= gfp_allowed_mask;
> - alloc_gfp = gfp;
> - if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags))
> + if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &gfp, &alloc_flags))
> goto out;
> - gfp = alloc_gfp;
>
> /* Find an allowed local zone that meets the low watermark. */
> z = ac.preferred_zoneref;
>
> ---
> base-commit: 57e5b07deacb0a9bd7b8c9b933ff72e902d4f06b
> change-id: 20260331-b4-prepare_alloc_pages-flags-5bb9a1e04e00
>
> Best regards,
> --
> Brendan Jackman <jackmanb@google.com>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/page_alloc: cleanup flag vars in alloc_pages_bulk_noprof()
2026-03-31 16:10 ` Suren Baghdasaryan
@ 2026-04-01 17:11 ` Vishal Moola
0 siblings, 0 replies; 5+ messages in thread
From: Vishal Moola @ 2026-04-01 17:11 UTC (permalink / raw)
To: Suren Baghdasaryan
Cc: Brendan Jackman, Andrew Morton, Vlastimil Babka, Michal Hocko,
Johannes Weiner, Zi Yan, linux-mm, linux-kernel
On Tue, Mar 31, 2026 at 09:10:11AM -0700, Suren Baghdasaryan wrote:
> On Tue, Mar 31, 2026 at 3:52 AM Brendan Jackman <jackmanb@google.com> wrote:
> >
> > These two variables are redundant, squash them to align
> > alloc_pages_bulk_noprof() with the style used in
> > alloc_frozen_pages_nolock_noprof().
>
> Indeed. I'm not sure why this was needed even in the original patch
> (387ba26fb1cb) that introduced this function. It carefully preserves
> the original gfp even though its value either gets overwritten later
> (prepare_alloc_pages succeeds) or is unused (prepare_alloc_pages
> fails)...
I did some digging and wasn't able to find any reason myself. It should
be fine without it.
Reviewed-by: Vishal Moola <vishal.moola@gmail.com>
> >
> > Signed-off-by: Brendan Jackman <jackmanb@google.com>
>
> Reviewed-by: Suren Baghdasaryan <surenb@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/page_alloc: cleanup flag vars in alloc_pages_bulk_noprof()
2026-03-31 10:52 [PATCH] mm/page_alloc: cleanup flag vars in alloc_pages_bulk_noprof() Brendan Jackman
2026-03-31 16:10 ` Suren Baghdasaryan
@ 2026-04-01 17:14 ` Vlastimil Babka (SUSE)
2026-04-02 2:29 ` Anshuman Khandual
2 siblings, 0 replies; 5+ messages in thread
From: Vlastimil Babka (SUSE) @ 2026-04-01 17:14 UTC (permalink / raw)
To: Brendan Jackman, Andrew Morton, Suren Baghdasaryan, Michal Hocko,
Johannes Weiner, Zi Yan
Cc: linux-mm, linux-kernel
On 3/31/26 12:52, Brendan Jackman wrote:
> These two variables are redundant, squash them to align
> alloc_pages_bulk_noprof() with the style used in
> alloc_frozen_pages_nolock_noprof().
>
> Signed-off-by: Brendan Jackman <jackmanb@google.com>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
> ---
> mm/page_alloc.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 111b54df8a3cb..5e280ded6e7ac 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5051,7 +5051,6 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
> struct per_cpu_pages *pcp;
> struct list_head *pcp_list;
> struct alloc_context ac;
> - gfp_t alloc_gfp;
> unsigned int alloc_flags = ALLOC_WMARK_LOW;
> int nr_populated = 0, nr_account = 0;
>
> @@ -5092,10 +5091,8 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
>
> /* May set ALLOC_NOFRAGMENT, fragmentation will return 1 page. */
> gfp &= gfp_allowed_mask;
> - alloc_gfp = gfp;
> - if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags))
> + if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &gfp, &alloc_flags))
> goto out;
> - gfp = alloc_gfp;
>
> /* Find an allowed local zone that meets the low watermark. */
> z = ac.preferred_zoneref;
>
> ---
> base-commit: 57e5b07deacb0a9bd7b8c9b933ff72e902d4f06b
> change-id: 20260331-b4-prepare_alloc_pages-flags-5bb9a1e04e00
>
> Best regards,
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/page_alloc: cleanup flag vars in alloc_pages_bulk_noprof()
2026-03-31 10:52 [PATCH] mm/page_alloc: cleanup flag vars in alloc_pages_bulk_noprof() Brendan Jackman
2026-03-31 16:10 ` Suren Baghdasaryan
2026-04-01 17:14 ` Vlastimil Babka (SUSE)
@ 2026-04-02 2:29 ` Anshuman Khandual
2 siblings, 0 replies; 5+ messages in thread
From: Anshuman Khandual @ 2026-04-02 2:29 UTC (permalink / raw)
To: Brendan Jackman, Andrew Morton, Vlastimil Babka,
Suren Baghdasaryan, Michal Hocko, Johannes Weiner, Zi Yan
Cc: linux-mm, linux-kernel
On 31/03/26 4:22 PM, Brendan Jackman wrote:
> These two variables are redundant, squash them to align
> alloc_pages_bulk_noprof() with the style used in
> alloc_frozen_pages_nolock_noprof().
>
> Signed-off-by: Brendan Jackman <jackmanb@google.com>
> ---
> mm/page_alloc.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 111b54df8a3cb..5e280ded6e7ac 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5051,7 +5051,6 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
> struct per_cpu_pages *pcp;
> struct list_head *pcp_list;
> struct alloc_context ac;
> - gfp_t alloc_gfp;
> unsigned int alloc_flags = ALLOC_WMARK_LOW;
> int nr_populated = 0, nr_account = 0;
>
> @@ -5092,10 +5091,8 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
>
> /* May set ALLOC_NOFRAGMENT, fragmentation will return 1 page. */
> gfp &= gfp_allowed_mask;
> - alloc_gfp = gfp;
> - if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags))
> + if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &gfp, &alloc_flags))
> goto out;
> - gfp = alloc_gfp;
>
> /* Find an allowed local zone that meets the low watermark. */
> z = ac.preferred_zoneref;
>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-04-02 2:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-31 10:52 [PATCH] mm/page_alloc: cleanup flag vars in alloc_pages_bulk_noprof() Brendan Jackman
2026-03-31 16:10 ` Suren Baghdasaryan
2026-04-01 17:11 ` Vishal Moola
2026-04-01 17:14 ` Vlastimil Babka (SUSE)
2026-04-02 2:29 ` Anshuman Khandual
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox