public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Brendan Jackman <jackmanb@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@suse.com>,
	David Rientjes <rientjes@google.com>,
	Shakeel Butt <shakeel.butt@linux.dev>,
	Suren Baghdasaryan <surenb@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>, Zi Yan <ziy@nvidia.com>,
	Harry Yoo <harry.yoo@oracle.com>, Hao Li <hao.li@linux.dev>,
	Christoph Lameter <cl@gentwo.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Uladzislau Rezki <urezki@gmail.com>,
	Matthew Wilcox <willy@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 0/5] mm: Switch gfp_t to unsigned long
Date: Thu, 19 Mar 2026 18:03:32 +0100	[thread overview]
Message-ID: <215517e5-a49b-4eb7-824c-8c42e4db046e@kernel.org> (raw)
In-Reply-To: <20260319-gfp64-v1-0-2c73b8d42b7f@google.com>

On 3/19/26 17:03, Brendan Jackman wrote:
> As pointed out by Vlastimil in [0], my proposal for __GFP_UNMAPPED is
> probably not needed for 32-bit. This offers a way out of the GFP flag
> scarcity so in preparation for this, flip gfp_t to be 64-bit on 64-bit
> machines, while leaving it 32-bit on 32-bit machines.

Thanks for tackling this! But now I'm wondering, if we decide to change it,
would it be worth trying to add some type safety too? To help with cases
like the recent kmalloc_objs() footgun discussed in this comment thread
https://lwn.net/Articles/1063356/

> For mm-internal code that prints raw GFP flags as hex, this just updates
> the format specifier to %lx. Presumably developers have a reason for
> wanting to see the whole flags word as a number in the log. For printks
> outside of mm/, I assume they are only using %x because the authors
> didn't know about %pGg, so they are converted to the latter as prep
> patches.
> 
> Stuff I've done to try and find issues with this:
> 
> - Built x86 allmodconfig and arm64 defconfig. Hopefully the 0-day bot
>   will alert me to the important builds I'm missing (I briefly tried to
>   build s390 and sparc64 but ran into tooling issues and gave up).
> 
> - Ran some selftests on a x86 VM.
> 
> - Poked around at stuff that refers to ___GFP_LAST_BIT to see if
>   anything looks wrong.
> 
> - Ran this Coccinelle script to look for explicit casts to plain int:
> 
> ---
> virtual report
> 
> @r@
> gfp_t x;
> position p;
> @@
> 
> (
>   (unsigned int)x@p
> |
>   (int)x@p
> )
> 
> @script:python depends on report@
> p << r.p;
> @@
> msg = "WARNING: Explicit integer cast of gfp_t"
> coccilib.report.print_report(p[0], msg)
> ---
> 
> Obviously this series doesn't "do anything" so maybe it doesn't make
> sense to merge it unless it goes in alongside __GFP_UNMAPPED, but it
> does seem to make sense to review it independently so I'm posting it as
> a separate series.
> 
> [0] https://lore.kernel.org/all/6206d021-e6c2-4899-b426-cacd71ebd5ef@kernel.org/
> 
> To: Andrew Morton <akpm@linux-foundation.org>
> To: Michal Hocko <mhocko@suse.com>
> To: David Rientjes <rientjes@google.com>
> To: Shakeel Butt <shakeel.butt@linux.dev>
> To: Vlastimil Babka <vbabka@kernel.org>
> To: Suren Baghdasaryan <surenb@google.com>
> To: Brendan Jackman <jackmanb@google.com>
> To: Johannes Weiner <hannes@cmpxchg.org>
> To: Zi Yan <ziy@nvidia.com>
> To: Harry Yoo <harry.yoo@oracle.com>
> To: Hao Li <hao.li@linux.dev>
> To: Christoph Lameter <cl@gentwo.org>
> To: Roman Gushchin <roman.gushchin@linux.dev>
> To: Uladzislau Rezki <urezki@gmail.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-mm@kvack.org
> 
> Signed-off-by: Brendan Jackman <jackmanb@google.com>
> 
> ---
> Brendan Jackman (5):
>       drm/managed: Use special gfp_t format specifier
>       iwlegacy: 3945-mac: Use special gfp_t format specifier
>       mm/kfence: Use special gfp_t format specifier
>       net/rds: Use special gfp_t format specifier
>       mm: Change gfp_t to unsigned long
> 
>  drivers/gpu/drm/drm_managed.c                  | 4 ++--
>  drivers/net/wireless/intel/iwlegacy/3945-mac.c | 4 ++--
>  include/linux/types.h                          | 2 +-
>  lib/test_lockup.c                              | 2 +-
>  mm/kfence/kfence_test.c                        | 2 +-
>  mm/oom_kill.c                                  | 2 +-
>  mm/page_alloc.c                                | 5 ++++-
>  mm/page_owner.c                                | 4 ++--
>  mm/slab_common.c                               | 2 +-
>  mm/slub.c                                      | 2 +-
>  mm/vmalloc.c                                   | 2 +-
>  net/rds/tcp_recv.c                             | 2 +-
>  12 files changed, 18 insertions(+), 15 deletions(-)
> ---
> base-commit: 8a30aeb0d1b4e4aaf7f7bae72f20f2ae75385ccb
> change-id: 20260319-gfp64-7a970a80ba4e
> 
> Best regards,



  parent reply	other threads:[~2026-03-19 17:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19 16:03 [PATCH 0/5] mm: Switch gfp_t to unsigned long Brendan Jackman
2026-03-19 16:03 ` [PATCH 1/5] drm/managed: Use special gfp_t format specifier Brendan Jackman
2026-03-19 16:03 ` [PATCH 2/5] iwlegacy: 3945-mac: " Brendan Jackman
2026-03-19 16:03 ` [PATCH 3/5] mm/kfence: " Brendan Jackman
2026-03-19 16:03 ` [PATCH 4/5] net/rds: " Brendan Jackman
2026-03-19 16:03 ` [PATCH 5/5] mm: Change gfp_t to unsigned long Brendan Jackman
2026-03-22 13:25   ` kernel test robot
2026-03-22 15:39   ` kernel test robot
2026-03-22 18:47   ` kernel test robot
2026-03-19 16:56 ` [PATCH 0/5] mm: Switch " Matthew Wilcox
2026-03-19 18:40   ` Brendan Jackman
2026-03-19 21:39     ` Matthew Wilcox
2026-03-20  9:48       ` Brendan Jackman
2026-03-20 10:02         ` Vlastimil Babka (SUSE)
2026-03-20 13:22         ` Brendan Jackman
2026-03-19 17:03 ` Vlastimil Babka (SUSE) [this message]
2026-03-19 17:38   ` Brendan Jackman
2026-03-19 19:58     ` Vlastimil Babka (SUSE)
2026-03-20  9:56       ` Brendan Jackman
2026-03-19 18:30 ` Zi Yan
2026-03-20  9:37 ` Brendan Jackman
2026-03-20 16:26   ` Andrew Morton

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=215517e5-a49b-4eb7-824c-8c42e4db046e@kernel.org \
    --to=vbabka@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=hannes@cmpxchg.org \
    --cc=hao.li@linux.dev \
    --cc=harry.yoo@oracle.com \
    --cc=jackmanb@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=surenb@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=urezki@gmail.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