From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f73.google.com (mail-ej1-f73.google.com [209.85.218.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3130238A719 for ; Fri, 20 Mar 2026 09:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774000577; cv=none; b=rH7mH/FQlOekLncEyJTsA6+G/9kpZ6HUV3drxKJFOHDLbBg44CS7o7KxppVDQj2H6RmLD5NbPGdqaPZJbexiEZOVwGqHnCMOAYv9JKVXjm6khisqCPun9zjKBchtim6w5hD0eJaiVOAUeF4i74qiMa3CzcVubulcndL0IDsMhUU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774000577; c=relaxed/simple; bh=sxGMyHI/Wriwd5CcL4LbHKF8O7YMw4/CyG7GLLyOkt4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=oJX1gqUNb/5JIPZyH4GlvN06LZ+3iOy3PeAQ52LE/X6ehClhDxOezINcJJaDZEa0NJ+cBfK+Owe0ePXD8eQuucRfHApe5PLaSY0+Sgymh++I9uwsv+NCONTgL+FPFuTGpnlyfmcCo7y27z7kNtYTRdcJUHiEK2T6/XceVVX0EUs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=jPFDrStC; arc=none smtp.client-ip=209.85.218.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="jPFDrStC" Received: by mail-ej1-f73.google.com with SMTP id a640c23a62f3a-b97fb810dddso38463566b.0 for ; Fri, 20 Mar 2026 02:56:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1774000572; x=1774605372; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=pKpxV/4cEGHvyDd70zFDmsfBmdYXsgVkPbeROZov/kY=; b=jPFDrStCOx91lusyEUIDjNh3MNPXqRWfxakwQagY5eOqp6BKxDyJVqsYSkhZ1XzVe/ UhKM/ulFxHutJhqJIcV5E1bucGPZqdhvaS4vAd8jTlGTqnr9cqNNvb9HA8KN17niNEva /rX+xJiV5Mt4nQ2mPR6l4WrZsev1FpXHo+pFHjLIdCWDw3F2Khdx8lME1rw4NZDLi3db Wxz0QdEE+KC4x6grTG5X3OAFLExQ2Pz6AevSGxu7u2MWaPTOPguzjsWfqd0bZ2f2MoI2 X5y+AgyYBCv5mSsNwoFKJ0MF7ETq5a6vvL5nNo4BTpjcGHoJpqz969tlxPV5VhAXIzrY 8LLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774000572; x=1774605372; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pKpxV/4cEGHvyDd70zFDmsfBmdYXsgVkPbeROZov/kY=; b=kPpXZRahIybljlQCDMbZd4nAB4sBpReE2RD9LYkyhofwycMzHUeZ9xdU69lbshcXgr yFn3SSoPE32M3HScltAKT1DXzoUf3FZFugZhSCHA9x7otvNKiw3CdMgqZX8jNvHW9xlc C9ce+eHJ60Eq5vfkO3w12PKkd2EEbS5BXrkghmIDVjFgNu3DDz+/eJPK8GrvvVOXFwCs hDVk9HkDidcb2ri2aIYOKqYXDwW5ztToYXwwBcU0pQ3y0TFWVynklyDJY26LlHSuaZGp O2dv1+k/xTxDbxyhmNHKLg7JT0KL2ZKVrUdfI8pMFIgkghzYrcadR9qoXBgQOOKxN6Tk Vzlw== X-Forwarded-Encrypted: i=1; AJvYcCU97/aetl4I3i3oZARx7LGUEfPV0camXohlAduXxbd1iPwDp3JcjokPTk8qLRq2dVZcUkVRXLJMBt2e/j0=@vger.kernel.org X-Gm-Message-State: AOJu0Yy/H5zdDYka4PmkWOGNTnN+c/JNOavoZClENGA7+AXFziHtlyFI 9Ot12YdsYh3rGiP0Btq9pSafRUh4LxmxvlPWk6luvM/1bc6oYCLIr0yVWo55r+t879F/kjIA9tg BeUNdvAdxQtfpfg== X-Received: from edsf23.prod.google.com ([2002:aa7:d857:0:b0:665:3ca8:7809]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a17:906:1d09:b0:b97:87e4:7f40 with SMTP id a640c23a62f3a-b982f37d43dmr149532466b.27.1774000572175; Fri, 20 Mar 2026 02:56:12 -0700 (PDT) Date: Fri, 20 Mar 2026 09:56:11 +0000 In-Reply-To: <6ff14b27-a494-4faa-94ed-ebbf63116125@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260319-gfp64-v1-0-2c73b8d42b7f@google.com> <215517e5-a49b-4eb7-824c-8c42e4db046e@kernel.org> <6ff14b27-a494-4faa-94ed-ebbf63116125@kernel.org> X-Mailer: aerc 0.21.0 Message-ID: Subject: Re: [PATCH 0/5] mm: Switch gfp_t to unsigned long From: Brendan Jackman To: "Vlastimil Babka (SUSE)" , Brendan Jackman Cc: 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 , , , Linus Torvalds Content-Type: text/plain; charset="UTF-8" On Thu Mar 19, 2026 at 7:58 PM UTC, Vlastimil Babka (SUSE) wrote: > On 3/19/26 18:38, Brendan Jackman wrote: >> On Thu, 19 Mar 2026 at 18:03, Vlastimil Babka (SUSE) 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. I think this is a C problem rather than a gfp_t problem though. Better to try and tackle it with treewide efforts like Sparse and Rust IMO. (Maybe gfp_t is the most common type of arg flags in the kernel? Could be an argument to be made there I guess). > 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). Yeah I think it would be very disruptive indeed. A thought I'll forward to Roman - we should try having Sashiko[1] run Sparse and read the output, if it doesn't already. [1] https://lwn.net/Articles/1063292/