[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260128-gfp-noio-v1-1-9a808fc49b44@kernel.org>
Date: Wed, 28 Jan 2026 19:37:12 +0100
From: Andreas Hindborg <a.hindborg@...nel.org>
To: Miguel Ojeda <ojeda@...nel.org>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Uladzislau Rezki <urezki@...il.com>
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
Andreas Hindborg <a.hindborg@...nel.org>
Subject: [PATCH] rust: alloc: add GFP_NOIO flag
Add an abstraction for the `GFP_NOIO` flag. This flag signals that the
caller requires allocation to complete without triggering any block device
IO.
Signed-off-by: Andreas Hindborg <a.hindborg@...nel.org>
---
rust/bindings/bindings_helper.h | 1 +
rust/kernel/alloc.rs | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
index a067038b4b422..3910ecc5c34cf 100644
--- a/rust/bindings/bindings_helper.h
+++ b/rust/bindings/bindings_helper.h
@@ -106,6 +106,7 @@ const size_t RUST_CONST_HELPER_PAGE_SIZE = PAGE_SIZE;
const gfp_t RUST_CONST_HELPER_GFP_ATOMIC = GFP_ATOMIC;
const gfp_t RUST_CONST_HELPER_GFP_KERNEL = GFP_KERNEL;
const gfp_t RUST_CONST_HELPER_GFP_KERNEL_ACCOUNT = GFP_KERNEL_ACCOUNT;
+const gfp_t RUST_CONST_HELPER_GFP_NOIO = GFP_NOIO;
const gfp_t RUST_CONST_HELPER_GFP_NOWAIT = GFP_NOWAIT;
const gfp_t RUST_CONST_HELPER___GFP_ZERO = __GFP_ZERO;
const gfp_t RUST_CONST_HELPER___GFP_HIGHMEM = ___GFP_HIGHMEM;
diff --git a/rust/kernel/alloc.rs b/rust/kernel/alloc.rs
index e38720349dcf7..5f6a0f7e99c03 100644
--- a/rust/kernel/alloc.rs
+++ b/rust/kernel/alloc.rs
@@ -99,6 +99,10 @@ pub mod flags {
/// The same as [`GFP_KERNEL`], except the allocation is accounted to kmemcg.
pub const GFP_KERNEL_ACCOUNT: Flags = Flags(bindings::GFP_KERNEL_ACCOUNT);
+ /// [`GFP_NOIO`] will use direct reclaim to discard clean pages or slab
+ /// pages that do not require the starting of any physical IO.
+ pub const GFP_NOIO: Flags = Flags(bindings::GFP_NOIO);
+
/// 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.
---
base-commit: 63804fed149a6750ffd28610c5c1c98cce6bd377
change-id: 20260128-gfp-noio-fbd41e135088
Best regards,
--
Andreas Hindborg <a.hindborg@...nel.org>
Powered by blists - more mailing lists