Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] The `ExclusivePage::alloc_page` method is missing the `#[inline]` 
attribute, violating the Rust subsystem guidelines for small abstraction 
functions.
--

commit 3d93318174c0f08ec348e7d20ff2086b2a3244a6
Author: Andreas Hindborg <[email protected]>

rust: page: add `ExclusivePage` for race-free page access

`ExclusivePage` wraps a regular page but adds an invariant that the
page data area does not incur data races. This means `ExclusivePage`
cannot be mapped to user space or shared with devices.

> diff --git a/rust/kernel/page.rs b/rust/kernel/page.rs
> index cd394b0656c0c..4e5b1c2f43466 100644
> --- a/rust/kernel/page.rs
> +++ b/rust/kernel/page.rs

[ ... ]

> +impl ExclusivePage {
> +    /// Allocates a new `ExclusivePage`.
> +    pub fn alloc_page(flags: Flags) -> Result<Owned<Self>, AllocError> {

[Severity: Low]
This isn't a bug, but should this abstraction wrapper around
bindings::alloc_pages() have an #[inline] attribute?

The Rust subsystem guidelines specify that abstraction functions forwarding to
C binding calls should be annotated with #[inline].

> +        // SAFETY: Depending on the value of `gfp_flags`, this call may 
> sleep. Other than that, it
> +        // is always safe to call this method.
> +        let page = unsafe { bindings::alloc_pages(flags.as_raw(), 0) };
> +        let page = NonNull::new(page).ok_or(AllocError)?;
> +

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=9

Reply via email to