Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Brendan Jackman" <brendan.jackman@linux.dev>
To: "Brendan Jackman" <jackmanb@google.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Michal Hocko" <mhocko@suse.com>,
	"Johannes Weiner" <hannes@cmpxchg.org>, "Zi Yan" <ziy@nvidia.com>
Cc: "Harry Yoo (Oracle)" <harry@kernel.org>,
	"Gregory Price" <gourry@gourry.net>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/page_alloc: drop flag-conversion "optimisation"
Date: Fri, 12 Jun 2026 14:53:28 +0000	[thread overview]
Message-ID: <DJ75N99GTI2T.3RLXWJLOISLH8@linux.dev> (raw)
In-Reply-To: <20260612-gfp-pessimisation-v1-1-936eb04202e7@google.com>

On Fri Jun 12, 2026 at 2:15 PM UTC, Brendan Jackman wrote:
> -	/*
> -	 * __GFP_HIGH is assumed to be the same as ALLOC_MIN_RESERVE
> -	 * and __GFP_KSWAPD_RECLAIM is assumed to be the same as ALLOC_KSWAPD
> -	 * to save two branches.
> -	 */
> -	BUILD_BUG_ON(__GFP_HIGH != (__force gfp_t) ALLOC_MIN_RESERVE);
> -	BUILD_BUG_ON(__GFP_KSWAPD_RECLAIM != (__force gfp_t) ALLOC_KSWAPD);

Agh, alloc_flags_nofragment() needs to be updated too:

diff --git c/mm/page_alloc.c i/mm/page_alloc.c
index 9e1949ea13a6d..0111cdbdb5321 100644
--- c/mm/page_alloc.c
+++ i/mm/page_alloc.c
@@ -3739,13 +3739,10 @@ static bool zone_allows_reclaim(struct zone *local_zone, struct zone *zone)
 static inline unsigned int
 alloc_flags_nofragment(struct zone *zone, gfp_t gfp_mask)
 {
-       unsigned int alloc_flags;
+       unsigned int alloc_flags = 0;

-       /*
-        * __GFP_KSWAPD_RECLAIM is assumed to be the same as ALLOC_KSWAPD
-        * to save a branch.
-        */
-       alloc_flags = (__force int) (gfp_mask & __GFP_KSWAPD_RECLAIM);
+       if (gfp_mask & __GFP_KSWAPD_RECLAIM)
+               alloc_flags |= ALLOC_KSWAPD;

        if (defrag_mode) {
                alloc_flags |= ALLOC_NOFRAGMENT;

I guess I will just send a v2 once I've tested since this is pretty easy
to review anyway, any objections?


  parent reply	other threads:[~2026-06-12 14:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12 14:15 [PATCH] mm/page_alloc: drop flag-conversion "optimisation" Brendan Jackman
2026-06-12 14:23 ` Brendan Jackman
2026-06-12 14:24 ` Vlastimil Babka (SUSE)
2026-06-12 14:53 ` Brendan Jackman [this message]
2026-06-12 15:06 ` Zi Yan
2026-06-12 16:04 ` Gregory Price
2026-06-12 16:33 ` Johannes Weiner

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=DJ75N99GTI2T.3RLXWJLOISLH8@linux.dev \
    --to=brendan.jackman@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=harry@kernel.org \
    --cc=jackmanb@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.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