From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCF573EF64E for ; Thu, 19 Mar 2026 17:03:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773939817; cv=none; b=IuH8UFJ2DUgVTRDjoF83em4nyd2W01XvLXBApEg7BP2wZmYqSQSFUuOgjgXXO9rzJQoTsBoQ1ZZOsa7jOV3OaHt1Tqk63MeO6UVBH2aIqkK065EbgfDG1S3ny+CtkFWeEK43ICb/ZWjidSY5Yx/PokdGBc027ecqiAHhF+XdMIc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773939817; c=relaxed/simple; bh=zhgENmoC3CJmwU0Ib1ROwyOlGYhPQDzEhDRfGXZjPZo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=f184psZGNgNX/Bz6xs8bsH1JEtZs9iheYgDcpHM4FtWotIJCpN+AnDKcP9oATJcgjdyLHZGgsIFMje4s4FRU3Pk1y3UeV5USkhxqBsI9sPrGYW54qnFvpa7VWjfJg7CQgozHZAnNEUziuYusmwYp9PH66+gaG/YAC5c+mR+dilA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dwHVmLew; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dwHVmLew" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 510C3C2BCAF; Thu, 19 Mar 2026 17:03:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773939817; bh=zhgENmoC3CJmwU0Ib1ROwyOlGYhPQDzEhDRfGXZjPZo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=dwHVmLew4A+G9r3Ag7Matgm/2aSbLT9tZKzaslblBADpH1YYS1QiyBQ5m2Fqg7Pgy YFUFoXT9rDzfvzJnKpCOKRelum/vtha9WXEfiQLuKWtZ/sUrycZwLx8aKy8D7qtjlX KDzA4xN2aXkcTANEua6MixLNFuiKPpUdgjXK8Wp/SOnotHq9rC9sbFEiUERDjmV53Z 65OjhmIKs9AAn+INbW+7Cb2LSnD4ULZXuzfLQHNXd0UkORrjDYouiNm19F7D8cHUrD DjFNpMkJfZNHuOBeg7erxulj5PBN6kDziMvbDHN6mCaGkdaNvUuwIJ5Dq96XydWgS7 OLyaemLVplRZw== Message-ID: <215517e5-a49b-4eb7-824c-8c42e4db046e@kernel.org> Date: Thu, 19 Mar 2026 18:03:32 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/5] mm: Switch gfp_t to unsigned long Content-Language: en-US To: Brendan Jackman , Andrew Morton , Michal Hocko , David Rientjes , Shakeel Butt , Suren Baghdasaryan , Johannes Weiner , Zi Yan , Harry Yoo , Hao Li , Christoph Lameter , Roman Gushchin , Uladzislau Rezki , Matthew Wilcox Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Linus Torvalds References: <20260319-gfp64-v1-0-2c73b8d42b7f@google.com> From: "Vlastimil Babka (SUSE)" In-Reply-To: <20260319-gfp64-v1-0-2c73b8d42b7f@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 > To: Michal Hocko > To: David Rientjes > To: Shakeel Butt > To: Vlastimil Babka > To: Suren Baghdasaryan > To: Brendan Jackman > To: Johannes Weiner > To: Zi Yan > To: Harry Yoo > To: Hao Li > To: Christoph Lameter > To: Roman Gushchin > To: Uladzislau Rezki > Cc: linux-kernel@vger.kernel.org > Cc: linux-mm@kvack.org > > Signed-off-by: Brendan Jackman > > --- > 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,