All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Brendan Jackman <jackmanb@google.com>
Cc: 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>,
	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 20:58:34 +0100	[thread overview]
Message-ID: <6ff14b27-a494-4faa-94ed-ebbf63116125@kernel.org> (raw)
In-Reply-To: <CA+i-1C1g=3_nK=Xq+OV8KU06YDo18ZaDJqbkfp21Z8G_cnkQww@mail.gmail.com>

On 3/19/26 18:38, Brendan Jackman wrote:
> On Thu, 19 Mar 2026 at 18:03, Vlastimil Babka (SUSE) <vbabka@kernel.org> wrote:
>>
>> 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/
> 
> Do you mean something similar to pgprot_t?

Yeah, at least I don't know a better way.

> I did that in [0] but I'm rather sheepish about it, I only went for it

Right.

> because I think it's especially needed for the specific "type" due to
> the migration path creating a high type-unsafety risk. And that was
> totally local to a few files in mm/.
> 
> Are there common issues with gfp_t in particular besides the
> kmalloc_objs() thing? If so then maybe it could make sense. It's not a
> problem I've ever run into myself though.

I think it's a hazard in any case where there are multiple arguments to a
function where one is gfp flags and other some integer, and somebody gets
the order wrong.

But I just verified that at least in the kmalloc_objs() mistake, sparse will
flag it, thanks to the __bitwise annotation. Would be better if compiler
did, but it makes the case for changing gfp_t smaller if it was too
disruptive (it likely would be).

> [0] https://lore.kernel.org/all/20260225-page_alloc-unmapped-v1-8-e8808a03cd66@google.com/



  reply	other threads:[~2026-03-19 19:58 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)
2026-03-19 17:38   ` Brendan Jackman
2026-03-19 19:58     ` Vlastimil Babka (SUSE) [this message]
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=6ff14b27-a494-4faa-94ed-ebbf63116125@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.