diff options
author | Jakub Kicinski <kuba@kernel.org> | 2024-08-01 10:43:15 -0700 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-08-01 10:45:23 -0700 |
commit | 5fa35bd39ce106889909444c937a10b2d3a79f08 (patch) | |
tree | bb1fde34b2c9907b1c4b69f6db992bbda0b02355 /rust/kernel/alloc.rs | |
parent | 743ff02152bc46bb4a2f2a49ec891c87eba6ab5b (diff) | |
parent | 183d46ff422ef9f3d755b6808ef3faa6d009ba3a (diff) | |
download | lwn-5fa35bd39ce106889909444c937a10b2d3a79f08.tar.gz lwn-5fa35bd39ce106889909444c937a10b2d3a79f08.zip |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Cross-merge networking fixes after downstream PR.
No conflicts or adjacent changes.
Link: https://patch.msgid.link/20240801131917.34494-1-pabeni@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'rust/kernel/alloc.rs')
-rw-r--r-- | rust/kernel/alloc.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/rust/kernel/alloc.rs b/rust/kernel/alloc.rs index 531b5e471cb1..1966bd407017 100644 --- a/rust/kernel/alloc.rs +++ b/rust/kernel/alloc.rs @@ -20,6 +20,13 @@ pub struct AllocError; #[derive(Clone, Copy)] pub struct Flags(u32); +impl Flags { + /// Get the raw representation of this flag. + pub(crate) fn as_raw(self) -> u32 { + self.0 + } +} + impl core::ops::BitOr for Flags { type Output = Self; fn bitor(self, rhs: Self) -> Self::Output { @@ -52,6 +59,14 @@ pub mod flags { /// This is normally or'd with other flags. pub const __GFP_ZERO: Flags = Flags(bindings::__GFP_ZERO); + /// Allow the allocation to be in high memory. + /// + /// Allocations in high memory may not be mapped into the kernel's address space, so this can't + /// be used with `kmalloc` and other similar methods. + /// + /// This is normally or'd with other flags. + pub const __GFP_HIGHMEM: Flags = Flags(bindings::__GFP_HIGHMEM); + /// Users can not sleep and need the allocation to succeed. /// /// A lower watermark is applied to allow access to "atomic reserves". The current @@ -66,7 +81,7 @@ 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); - /// Ror kernel allocations that should not stall for direct reclaim, start physical IO or + /// 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. pub const GFP_NOWAIT: Flags = Flags(bindings::GFP_NOWAIT); |