[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z7zLKNcvvga08jcw@thinkpad>
Date: Mon, 24 Feb 2025 14:40:24 -0500
From: Yury Norov <yury.norov@...il.com>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
Danilo Krummrich <dakr@...hat.com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Vincent Guittot <vincent.guittot@...aro.org>,
Stephen Boyd <sboyd@...nel.org>, Nishanth Menon <nm@...com>,
Manos Pitsidianakis <manos.pitsidianakis@...aro.org>,
Erik Schilling <erik.schilling@...aro.org>,
Alex Bennée <alex.bennee@...aro.org>,
Joakim Bech <joakim.bech@...aro.org>, Rob Herring <robh@...nel.org>,
Christoph Hellwig <hch@....de>, Jason Gunthorpe <jgg@...dia.com>,
John Hubbard <jhubbard@...dia.com>, linux-pm@...r.kernel.org,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] rust: Add cpumask helpers
On Mon, Feb 24, 2025 at 02:26:13PM +0530, Viresh Kumar wrote:
> Hi Yury,
>
> On 21-02-25, 15:56, Yury Norov wrote:
> > Question: zalloc_cpumask_war() is a convenient wrapper around
> > alloc_cpumask_var_node(). Maybe rust can use the latter directly as it's
> > a true outlined function? There's more flexibility, if you need it, but
> > also a higher risk that the API will change: ~40 users vs 180 for zalloc
> > thing. Up to you guys. I can send v2 if needed.
>
> I looked at the APIs again and here is what I feel:
>
> - I am not sure if the Rust code will have any users of the *_node()
> APIs in the near future. i.e. There is no need for the Rust code to
> implement Cpumask::new_node() version for now.
>
> - I have missed implementing the uninitialized version earlier,
> alloc_cpumask_var(), which I think should be implemented right away.
> Bindings for alloc_cpumask_var() are required to be added for this
> though.
>
> - One advantage of using zalloc_cpumask_var() instead of
> alloc_cpumask_var() is that we don't need to open code it in the
> Rust code, specifically for the !CONFIG_CPUMASK_OFFSTACK case where
> we need to call cpumask_clear() separately.
>
> - The Rust side can have following abstractions for now:
>
> pub fn new() -> Result<Self>;
> pub fn new_zeroed() -> Result<Self>;
>
> --
> viresh
OK, if you need both I'll export both. I'll send it in v2 together
with clarifications from discussion with Miguel.
Powered by blists - more mailing lists