[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zryy04DvEsnxsRCj@pollux>
Date: Wed, 14 Aug 2024 15:36:19 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: ojeda@...nel.org, alex.gaynor@...il.com, wedsonaf@...il.com,
boqun.feng@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
benno.lossin@...ton.me, a.hindborg@...sung.com,
akpm@...ux-foundation.org, daniel.almeida@...labora.com,
faith.ekstrand@...labora.com, boris.brezillon@...labora.com,
lina@...hilina.net, mcanal@...lia.com, zhiw@...dia.com,
cjia@...dia.com, jhubbard@...dia.com, airlied@...hat.com,
ajanulgu@...hat.com, lyude@...hat.com, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v5 04/26] rust: alloc: implement `Allocator` for `Kmalloc`
On Wed, Aug 14, 2024 at 09:51:34AM +0200, Alice Ryhl wrote:
> On Mon, Aug 12, 2024 at 8:24 PM Danilo Krummrich <dakr@...nel.org> wrote:
> >
> > Implement `Allocator` for `Kmalloc`, the kernel's default allocator,
> > typically used for objects smaller than page size.
> >
> > All memory allocations made with `Kmalloc` end up in `krealloc()`.
> >
> > It serves as allocator for the subsequently introduced types `KBox` and
> > `KVec`.
> >
> > Signed-off-by: Danilo Krummrich <dakr@...nel.org>
> > ---
> > rust/helpers.c | 3 +-
> > rust/kernel/alloc.rs | 2 +-
> > rust/kernel/alloc/allocator.rs | 63 +++++++++++++++++++++++++++++++++-
> > 3 files changed, 64 insertions(+), 4 deletions(-)
> >
> > diff --git a/rust/helpers.c b/rust/helpers.c
> > index 92d3c03ae1bd..9f7275493365 100644
> > --- a/rust/helpers.c
> > +++ b/rust/helpers.c
> > @@ -193,8 +193,7 @@ void rust_helper_init_work_with_key(struct work_struct *work, work_func_t func,
> > }
> > EXPORT_SYMBOL_GPL(rust_helper_init_work_with_key);
> >
> > -void * __must_check __realloc_size(2)
> > -rust_helper_krealloc(const void *objp, size_t new_size, gfp_t flags)
> > +void *rust_helper_krealloc(const void *objp, size_t new_size, gfp_t flags)
> > {
> > return krealloc(objp, new_size, flags);
> > }
>
> Why are the various annotations on this helper being removed?
rust_helper_krealloc() is only called from Rust, hence neither __must_check nor
__realloc_size() should have any effect.
I also do not apply them in subsequent commits for the vrealloc() and
kvrealloc() helpers for this reason and removed them here for consistency.
> This deserves an explanation in the commit message.
I can also add a separate commit for that.
>
> Alice
>
Powered by blists - more mailing lists