From: Alice Ryhl <aliceryhl@google.com>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Danilo Krummrich <dakr@kernel.org>,
Vitaly Wool <vitaly.wool@konsulko.se>,
linux-mm@kvack.org, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org,
Uladzislau Rezki <urezki@gmail.com>,
Vlastimil Babka <vbabka@suse.cz>,
rust-for-linux@vger.kernel.org,
Liam Howlett <liam.howlett@oracle.com>
Subject: Re: [PATCH v11 0/4] support large align and nid in Rust allocators
Date: Wed, 9 Jul 2025 11:31:31 +0000 [thread overview]
Message-ID: <aG5TE3oq1w1cSdOy@google.com> (raw)
In-Reply-To: <54fc10ce-c3b6-4571-93e7-eebfc538d0c7@lucifer.local>
On Tue, Jul 08, 2025 at 02:19:38PM +0100, Lorenzo Stoakes wrote:
> On Tue, Jul 08, 2025 at 01:55:18PM +0200, Danilo Krummrich wrote:
> > On Tue, Jul 08, 2025 at 11:58:06AM +0100, Lorenzo Stoakes wrote:
> > > +cc Liam
> > >
> > > Hi guys,
> > >
> > > We have a section in MAINTAINERS for mm rust (MEMORY MANAGEMENT - RUST), so
> > > it's slightly concerning to find a series (at v11!) like this that changes
> > > mm-related stuff and it involves files not listed there and nobody bothered
> > > to cc- the people listed there.
> >
> > What files are you referring to? Are you referring to:
> >
> > rust/kernel/alloc.rs
> > rust/kernel/alloc/*
> >
> > If so, they're indeed not under the "MEMORY MANAGEMENT - RUST" entry, which
> > so far seems correct.
>
> Looking at these, they seem to be intended to be the primary means by which
> slab/vmalloc allocations will be managed in rust kernel code correct?
>
> There's also stuff relating to NUMA etc.
>
> I really do wonder where the line between this and the mm stuff is. Because
> if the idea is 'well this is just a wrapper around slab/vmalloc' surely the
> same can be said of what's in rust/kernel/mm.rs re: VMAs?
>
> So if this is the rust equivalent of include/linux/slab.h and mm/slub.c
> then that does seem to me to suggest this should be considered an mm/rust
> thing right?
>
> It'd be good to know exactly what is considered mm rust and should go
> through the mm tree and what isn't.
>
> Maybe Alice has some insights on this?
The Rust standard library has three pieces:
- core. Defines standard types that can work anywhere. (such as ints)
- alloc. Defines standard types that require an allocator. (such as vectors)
- std. Defines standard types that require an OS. (such as File or TcpStream)
In the kernel we used to use both core and alloc, but we switched away
from alloc because it doesn't support GFP flags well. The 'RUST [ALLOC]'
subsystem originates from that transition from the Rust stdlib alloc to
our own implementation. It contains essentially three pieces:
- Two data structures Vec and Box.
- The Box data structure is the simplest possible user of allocation:
A Box<T> stores a single instance of the struct T in its own
allocation.
- The Vec data structure stores a resizable array and maintains a
pointer, length, capacity triplet. There is a bunch of logic to
manipulate these to correctly keep track of which parts of the
vector are in use.
- The Allocator trait.
- This trait defines what functions an allocator must provide.
- The data structures Box or Vec require you to specify an allocator,
and internally it calls into the allocator to manage the backing
memory for its data.
- Three concrete implementations of the Allocator trait.
- These are kmalloc, vmalloc, and kvmalloc respectively.
In my eyes, the further down this list you get, the more likely it is
that the patch needs to go through the MM tree.
Alice
next prev parent reply other threads:[~2025-07-09 11:31 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 16:47 [PATCH v11 0/4] support large align and nid in Rust allocators Vitaly Wool
2025-07-07 16:48 ` [PATCH v11 1/4] mm/vmalloc: allow to set node and align in vrealloc Vitaly Wool
2025-07-08 12:12 ` Vlastimil Babka
2025-07-07 16:49 ` [PATCH v11 2/4] mm/slub: allow to set node and align in k[v]realloc Vitaly Wool
2025-07-08 12:52 ` Vlastimil Babka
2025-07-08 14:03 ` Vitaly Wool
2025-07-09 13:40 ` Vitaly Wool
2025-07-09 14:13 ` Vlastimil Babka
2025-07-07 16:49 ` [PATCH v11 3/4] rust: add support for NUMA ids in allocations Vitaly Wool
2025-07-08 12:15 ` Danilo Krummrich
2025-07-07 16:49 ` [PATCH v11 4/4] rust: support large alignments " Vitaly Wool
2025-07-08 12:16 ` Danilo Krummrich
2025-07-08 10:58 ` [PATCH v11 0/4] support large align and nid in Rust allocators Lorenzo Stoakes
2025-07-08 11:12 ` Lorenzo Stoakes
2025-07-08 11:55 ` Danilo Krummrich
2025-07-08 12:36 ` Lorenzo Stoakes
2025-07-08 13:41 ` Danilo Krummrich
2025-07-08 14:06 ` Lorenzo Stoakes
2025-07-08 13:19 ` Lorenzo Stoakes
2025-07-08 14:16 ` Danilo Krummrich
2025-07-08 14:39 ` Lorenzo Stoakes
2025-07-08 15:11 ` Danilo Krummrich
2025-07-08 15:40 ` Lorenzo Stoakes
2025-07-09 11:31 ` Alice Ryhl [this message]
2025-07-09 12:24 ` Lorenzo Stoakes
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=aG5TE3oq1w1cSdOy@google.com \
--to=aliceryhl@google.com \
--cc=akpm@linux-foundation.org \
--cc=dakr@kernel.org \
--cc=liam.howlett@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=urezki@gmail.com \
--cc=vbabka@suse.cz \
--cc=vitaly.wool@konsulko.se \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).