[PATCH 0/5] mm: Switch gfp_t to unsigned long
From: Brendan Jackman
Date: Thu Mar 19 2026 - 12:16:20 EST
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.
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@xxxxxxxxxx/
To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
To: Michal Hocko <mhocko@xxxxxxxx>
To: David Rientjes <rientjes@xxxxxxxxxx>
To: Shakeel Butt <shakeel.butt@xxxxxxxxx>
To: Vlastimil Babka <vbabka@xxxxxxxxxx>
To: Suren Baghdasaryan <surenb@xxxxxxxxxx>
To: Brendan Jackman <jackmanb@xxxxxxxxxx>
To: Johannes Weiner <hannes@xxxxxxxxxxx>
To: Zi Yan <ziy@xxxxxxxxxx>
To: Harry Yoo <harry.yoo@xxxxxxxxxx>
To: Hao Li <hao.li@xxxxxxxxx>
To: Christoph Lameter <cl@xxxxxxxxxx>
To: Roman Gushchin <roman.gushchin@xxxxxxxxx>
To: Uladzislau Rezki <urezki@xxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: linux-mm@xxxxxxxxx
Signed-off-by: Brendan Jackman <jackmanb@xxxxxxxxxx>
---
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,
--
Brendan Jackman <jackmanb@xxxxxxxxxx>