From nobody Sun Feb 8 20:59:03 2026 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (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 AEC7A318146 for ; Fri, 19 Dec 2025 11:33:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766143985; cv=none; b=kSh3gJN4n089w2LLXBGZo6F/Wpy0joAIUrZZhxfOHUy/fO2aYtaFSqIH4FM/PX5ZPEED6zskqzL3zlwtrbZ90mdSLQqSp12pVWXzx31+MPXxo3vWpizOWBae45U3MKmopXQduZzYU+aFHr3ogmMJ9mlNrwwa4nmNYTw8EFOStM4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766143985; c=relaxed/simple; bh=M6hvy/jCZMiK74z2GIEIrV8DdZf0DoXTol/OpIZNaCY=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=btGh8bXNuiIHRowqExRyWDtI5h/U64rBtGsdbImCX/AO6y365mrBlSwALgmfMK0tHUIi9M3V8+M38cKYFrIevfunT1L1e48KVEJFVMPaUJ0XLLWXhFO5BZKfS4zmzQ+EIhM6OV3AHWsNm6L2PZ31xDhJbMqYsU13tNZ5DB96JL8= 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=Uf32IeF3; arc=none smtp.client-ip=209.85.128.74 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="Uf32IeF3" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-477a0ddd1d4so16109615e9.0 for ; Fri, 19 Dec 2025 03:33:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766143981; x=1766748781; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=hAAxcJSHCKa5e7JujPbI6PKo3xCnh6kgp+1s4KhQ0VM=; b=Uf32IeF3OzenEUsBB+iKN/Da25RNKY2pYuPRlgE1m+e9eO3kzt4jG5Kljyyp6nxK2S n4SyBbI0bx81LIkQIeoNecBejG56FWcFgVsBHPfidKyELrtpgcyr3NmraHEqNVA6UrgQ nYeXeEKgESqL25Y10jCuQyXv/S5EEFVt85BBvCtoFsiJ4Q/2brtb6vtX8hgUrys2fKw1 5IGTXzL2C0rMRav9YptGBZqbJpLlPnOdUyULL6C4l/RN108ezhhiZ96gf31WeF/H1uOv msjehJKhIuf6rLBDmjrW4MAc9dXtj7ruemHruiwrGJj9hhwSjWR2nW+bJcHMOT9y0rY3 JpnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766143981; x=1766748781; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=hAAxcJSHCKa5e7JujPbI6PKo3xCnh6kgp+1s4KhQ0VM=; b=oLfaW31GZv1+9/wv7eL8sYbiIPoURtyh7xdbjVkfPCYk0rdAmkMiOar4NdKbnVTL17 tfY5A1idUJoQS5jb/n1A/h/dwx3Sga4N1Ve6H6W4d6UiYo7zC4pGJajyhFag76uNn4z5 tix3xTCY7PfNodemcx9Ubq4JWDUabmfYEn0dRsZvOoA95HOuTE0JOJey9gpJk/GvqAc8 agSkliHm1FjIPFQoTqfS62M049ZAsLcrtRDAu2DOA2p0c473OWZNwQm8PniyE/Y/2kcZ mTm16fxR5yDVPK73xd6D3MzG3m+nxxCPZksoAHOy+tUkCSn0rJ1rMo3b/bTq6TUgt5dm voUg== X-Forwarded-Encrypted: i=1; AJvYcCUtKnBO/de8jCTjqcIS8P4HbX8XBKXNAa3e2YvmVYeh1mmc2gQwP04KdKqgzj1xt66/8omtpvkE6ZIQZyg=@vger.kernel.org X-Gm-Message-State: AOJu0Yw15AwADTSeJ+q80M2MaAItH/iE5kCHoPRQUNrmVwOEYF+KQYK0 trhhebvyjwR7u612SoOsbZVpJUIkZoaZr4WytR+mj+w6/ctSEId1UnXfryiheQoDH5GEbdsP1gU 7x/z0nrflKjpunw== X-Google-Smtp-Source: AGHT+IFtEw/tE5Tma1oMoU1xWJDXu8dPIDS5WBCwLqxTONYM7wj02qZJ3F/C/QiLC8f4W8TibL2BPHLQh6Hw1g== X-Received: from wmps26.prod.google.com ([2002:a05:600c:319a:b0:479:2d82:5535]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:c08a:b0:46e:1abc:1811 with SMTP id 5b1f17b1804b1-47d197f67edmr16343165e9.27.1766143980920; Fri, 19 Dec 2025 03:33:00 -0800 (PST) Date: Fri, 19 Dec 2025 11:32:18 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAME3RWkC/x3MQQqAIBBA0avErBvIKRd2lYgom2oWamhEIN09a fkW/2dIHIUT9FWGyLckCb6A6grsMfudUdZioIa0ImVw6XDfzmm+ghOLNjjH/sKWtdGN0qRaA6U 9I2/y/N9hfN8PG6QN7WcAAAA= X-Change-Id: 20251219-b4-gfp_atomic-comment-3e5950152139 X-Mailer: b4 0.14.2 Message-ID: <20251219-b4-gfp_atomic-comment-v2-1-4c4ce274c2b6@google.com> Subject: [PATCH v2] mm: clarify GFP_ATOMIC/GFP_NOWAIT doc-comment From: Brendan Jackman To: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Brendan Jackman Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The current description of contexts where it's invalid to make GFP_ATOMIC and GFP_NOWAIT calls is rather vague. Replace this with a direct description of the actual contexts of concern and refer to the RT docs where this is explained more discursively. While rejigging this prose, also move the documentation of GFP_NOWAIT to the GFP_NOWAIT section. Link: https://lore.kernel.org/all/d912480a-5229-4efe-9336-b31acded30f5@suse= .cz/ Acked-by: Vlastimil Babka Acked-by: David Hildenbrand (Red Hat) Signed-off-by: Brendan Jackman Acked-by: Mike Rapoport (Microsoft) --- Changes in v2: - Specified section in docs reference - Link to v1: https://lore.kernel.org/all/DF0J58HOVLL4.2E16Q87D2UXRW@google= .com/ --- include/linux/gfp_types.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/gfp_types.h b/include/linux/gfp_types.h index 3de43b12209ee79f84e7c9c919729303338433ff..814bb2892f99b829fde9b6dce1a= 317b3f29d01dc 100644 --- a/include/linux/gfp_types.h +++ b/include/linux/gfp_types.h @@ -309,8 +309,10 @@ enum { * * %GFP_ATOMIC users can not sleep and need the allocation to succeed. A l= ower * watermark is applied to allow access to "atomic reserves". - * The current implementation doesn't support NMI and few other strict - * non-preemptive contexts (e.g. raw_spin_lock). The same applies to %GFP_= NOWAIT. + * The current implementation doesn't support NMI, nor contexts that disab= le + * preemption under PREEMPT_RT. This includes raw_spin_lock() and plain + * preempt_disable() - see "Memory allocation" in + * Documentation/core-api/real-time/differences.rst for more info. * * %GFP_KERNEL is typical for kernel-internal allocations. The caller requ= ires * %ZONE_NORMAL or a lower zone for direct access but can direct reclaim. @@ -321,6 +323,7 @@ enum { * %GFP_NOWAIT is for kernel allocations that should not stall for direct * reclaim, start physical IO or use any filesystem callback. It is very * likely to fail to allocate memory, even for very small allocations. + * The same restrictions on calling contexts apply as for %GFP_ATOMIC. * * %GFP_NOIO will use direct reclaim to discard clean pages or slab pages * that do not require the starting of any physical IO. --- base-commit: fc2af7a8060126c3a99fc1dfd7c5abd71a4dc81d change-id: 20251219-b4-gfp_atomic-comment-3e5950152139 Best regards, --=20 Brendan Jackman