All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andreas Hindborg" <a.hindborg@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>,
	"Thomas Gleixner" <tglx@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	"Uladzislau Rezki" <urezki@gmail.com>,
	"Yury Norov" <yury.norov@gmail.com>,
	"Yury Norov" <ynorov@nvidia.com>,
	"Andrew Morton" <akpm@linux-foundation.org>
Cc: "Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Michal Hocko" <mhocko@suse.com>,
	"Brendan Jackman" <brendan.jackman@linux.dev>,
	"Johannes Weiner" <hannes@cmpxchg.org>, "Zi Yan" <ziy@nvidia.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH v4 2/2] rust: alloc: move `NumaNode` to the `numa` module
Date: Sat, 31 Oct 2026 16:08:51 +0000	[thread overview]
Message-ID: <sashiko-outbox-192033@kernel.org> (raw)
In-Reply-To: <20261030-cpu-helpers-v4-2-a8d840d34837@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] rust: missing #[inline] on NumaNode::as_raw()
--

commit 642cdfa1b2261df4d8bb7af89b382fd608fe93f2
Author: Andreas Hindborg <a.hindborg@kernel.org>

rust: alloc: move `NumaNode` to the `numa` module

This commit moves the NumaNode type from the alloc module to the numa
module and adds an as_raw() accessor so callers outside the numa module
can obtain the raw node ID.

Link: https://lore.kernel.org/all/aiZvKPFCkqJUsP0a@google.com/

> diff --git a/rust/kernel/numa.rs b/rust/kernel/numa.rs
> index 164e622d325f8..4a3a880308f3d 100644
> --- a/rust/kernel/numa.rs
> +++ b/rust/kernel/numa.rs
[ ... ]
> @@ -27,3 +30,33 @@ pub fn num_online_nodes() -> u32 {
>          bindings::nr_online_nodes
>      }
>  }
> +
> +/// Non Uniform Memory Access (NUMA) node identifier.
> +#[derive(Clone, Copy, PartialEq)]
> +pub struct NumaNode(i32);
> +
> +impl NumaNode {
> +    /// Create a new NUMA node identifier (non-negative integer).
> +    ///
> +    /// Returns [`EINVAL`] if a negative id or an id exceeding [`bindings::MAX_NUMNODES`] is
> +    /// specified.
> +    pub fn new(node: i32) -> Result<Self> {
> +        // MAX_NUMNODES never exceeds 2**10 because NODES_SHIFT is 0..10.
> +        if node < 0 || node >= bindings::MAX_NUMNODES as i32 {
> +            return Err(EINVAL);
> +        }
> +        Ok(Self(node))
> +    }
> +
> +    /// Get the raw representation of this node identifier.
> +    pub(crate) fn as_raw(self) -> i32 {
> +        self.0
> +    }

[Severity: Low]
As reported by Sashiko on v3 [1], this isn't a bug, but should
NumaNode::as_raw() in rust/kernel/numa.rs be marked #[inline] since it is
a small accessor function in the kernel crate called by
ReallocFunc::call() in rust/kernel/alloc/allocator.rs?

[1] https://lore.kernel.org/r/20260929-cpu-helpers-v3-3-e968ce5ee613@kernel.org

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261030-cpu-helpers-v4-0-a8d840d34837@kernel.org?part=2


      reply	other threads:[~2026-10-31 16:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 16:08 [PATCH v4 0/2] rust: add a few helpers Andreas Hindborg
2026-10-30 16:08 ` [PATCH v4 1/2] rust: add a wrapper for the `nr_online_nodes` C function Andreas Hindborg
2026-10-30 19:03   ` Boqun Feng
2026-10-30 16:08 ` [PATCH v4 2/2] rust: alloc: move `NumaNode` to the `numa` module Andreas Hindborg
2026-10-31 16:08   ` sashiko-bot [this message]

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=sashiko-outbox-192033@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=brendan.jackman@linux.dev \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=hannes@cmpxchg.org \
    --cc=liam@infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=ljs@kernel.org \
    --cc=lossin@kernel.org \
    --cc=mhocko@suse.com \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=surenb@google.com \
    --cc=tamird@kernel.org \
    --cc=tglx@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=urezki@gmail.com \
    --cc=vbabka@kernel.org \
    --cc=work@onurozkan.dev \
    --cc=ynorov@nvidia.com \
    --cc=yury.norov@gmail.com \
    --cc=ziy@nvidia.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.