<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/rust/kernel/mm, branch v6.18</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.18</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.18'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2025-09-13T23:55:15Z</updated>
<entry>
<title>rust: mm: update ARef and AlwaysRefCounted imports from sync::aref</title>
<updated>2025-09-13T23:55:15Z</updated>
<author>
<name>Shankari Anand</name>
<email>shankari.ak0208@gmail.com</email>
</author>
<published>2025-07-16T09:11:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9907e1df31c0f4bdcebe16de809121baa754e5b5'/>
<id>urn:sha1:9907e1df31c0f4bdcebe16de809121baa754e5b5</id>
<content type='text'>
Update call sites in the mm subsystem to import `ARef` and
`AlwaysRefCounted` from `sync::aref` instead of `types`.

This aligns with the ongoing effort to move `ARef` and `AlwaysRefCounted`
to sync.

Link: https://lkml.kernel.org/r/20250716091158.812860-1-shankari.ak0208@gmail.com
Signed-off-by: Shankari Anand &lt;shankari.ak0208@gmail.com&gt;
Suggested-by: Benno Lossin &lt;lossin@kernel.org&gt;
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Acked-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Cc: Alex Gaynor &lt;alex.gaynor@gmail.com&gt;
Cc: Andreas Hindborg &lt;a.hindborg@kernel.org&gt;
Cc: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Danilo Krummrich &lt;dakr@kernel.org&gt;
Cc: Gary Guo &lt;gary@garyguo.net&gt;
Cc: Liam Howlett &lt;liam.howlett@oracle.com&gt;
Cc: Lorenzo Stoakes &lt;lorenzo.stoakes@oracle.com&gt;
Cc: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Cc: Trevor Gross &lt;tmgross@umich.edu&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>rust: mm: mark VmaNew as transparent</title>
<updated>2025-08-28T05:45:41Z</updated>
<author>
<name>Baptiste Lepers</name>
<email>baptiste.lepers@gmail.com</email>
</author>
<published>2025-08-12T13:26:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5cc5e030bce2ec97ae5cdb2c1b94a98b1047b3fa'/>
<id>urn:sha1:5cc5e030bce2ec97ae5cdb2c1b94a98b1047b3fa</id>
<content type='text'>
Unsafe code in VmaNew's methods assumes that the type has the same layout
as the inner `bindings::vm_area_struct`.  This is not guaranteed by the
default struct representation in Rust, but requires specifying the
`transparent` representation.

Link: https://lkml.kernel.org/r/20250812132712.61007-1-baptiste.lepers@gmail.com
Fixes: dcb81aeab406 ("mm: rust: add VmaNew for f_ops-&gt;mmap()")
Signed-off-by: Baptiste Lepers &lt;baptiste.lepers@gmail.com&gt;
Reviewed-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Cc: Alex Gaynor &lt;alex.gaynor@gmail.com&gt;
Cc: Andreas Hindborg &lt;a.hindborg@kernel.org&gt;
Cc: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Danilo Krummrich &lt;dakr@kernel.org&gt;
Cc: Gary Guo &lt;gary@garyguo.net&gt;
Cc: Jann Horn &lt;jannh@google.com&gt;
Cc: Liam Howlett &lt;liam.howlett@oracle.com&gt;
Cc: Lorenzo Stoakes &lt;lorenzo.stoakes@oracle.com&gt;
Cc: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Cc: Trevor Gross &lt;tmgross@umich.edu&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>rust: enable `clippy::as_underscore` lint</title>
<updated>2025-06-22T21:09:17Z</updated>
<author>
<name>Tamir Duberstein</name>
<email>tamird@gmail.com</email>
</author>
<published>2025-06-15T20:55:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5e30550558b1eace5fa4af4e2257216fa8a7c90f'/>
<id>urn:sha1:5e30550558b1eace5fa4af4e2257216fa8a7c90f</id>
<content type='text'>
In Rust 1.63.0, Clippy introduced the `as_underscore` lint [1]:

&gt; The conversion might include lossy conversion or a dangerous cast that
&gt; might go undetected due to the type being inferred.
&gt;
&gt; The lint is allowed by default as using `_` is less wordy than always
&gt; specifying the type.

Always specifying the type is especially helpful in function call
contexts where the inferred type may change at a distance. Specifying
the type also allows Clippy to spot more cases of `useless_conversion`.

The primary downside is the need to specify the type in trivial getters.
There are 4 such functions: 3 have become slightly less ergonomic, 1 was
revealed to be a `useless_conversion`.

While this doesn't eliminate unchecked `as` conversions, it makes such
conversions easier to scrutinize.  It also has the slight benefit of
removing a degree of freedom on which to bikeshed. Thus apply the
changes and enable the lint -- no functional change intended.

Link: https://rust-lang.github.io/rust-clippy/master/index.html#as_underscore [1]
Reviewed-by: Benno Lossin &lt;benno.lossin@proton.me&gt;
Reviewed-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Signed-off-by: Tamir Duberstein &lt;tamird@gmail.com&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Acked-by: Danilo Krummrich &lt;dakr@kernel.org&gt;
Link: https://lore.kernel.org/r/20250615-ptr-as-ptr-v12-4-f43b024581e8@gmail.com
[ Changed `isize` to `c_long`. - Miguel ]
Signed-off-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
</content>
</entry>
<entry>
<title>mm: rust: make CONFIG_MMU ifdefs more narrow</title>
<updated>2025-06-01T05:46:12Z</updated>
<author>
<name>Alice Ryhl</name>
<email>aliceryhl@google.com</email>
</author>
<published>2025-05-16T19:32:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5a78977262f47dd52a4880689a2ca3d21dbf149a'/>
<id>urn:sha1:5a78977262f47dd52a4880689a2ca3d21dbf149a</id>
<content type='text'>
Currently the entire kernel::mm module is ifdef'd out when CONFIG_MMU=n.
However, there are some downstream users of the module in
rust/kernel/task.rs and rust/kernel/miscdevice.rs. Thus, update the cfgs
so that only MmWithUserAsync is removed with CONFIG_MMU=n.

The code is moved into a new file, since the #[cfg()] annotation
otherwise has to be duplicated several times.

Link: https://lkml.kernel.org/r/20250516193219.2987032-1-aliceryhl@google.com
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Closes: https://lore.kernel.org/oe-kbuild-all/202505071753.kldNHYVQ-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202505072116.eSYC8igT-lkp@intel.com/
Fixes: 5bb9ed6cdfeb ("mm: rust: add abstraction for struct mm_struct")
Signed-off-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Reviewed-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Liam Howlett &lt;liam.howlett@oracle.com&gt;
Cc: Lorenzo Stoakes &lt;lorenzo.stoakes@oracle.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>mm: rust: add VmaNew for f_ops-&gt;mmap()</title>
<updated>2025-05-12T00:48:25Z</updated>
<author>
<name>Alice Ryhl</name>
<email>aliceryhl@google.com</email>
</author>
<published>2025-04-08T09:22:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dcb81aeab406e417bc0b4cf68de6eb07a1d2e6ce'/>
<id>urn:sha1:dcb81aeab406e417bc0b4cf68de6eb07a1d2e6ce</id>
<content type='text'>
This type will be used when setting up a new vma in an f_ops-&gt;mmap() hook.
Using a separate type from VmaRef allows us to have a separate set of
operations that you are only able to use during the mmap() hook.  For
example, the VM_MIXEDMAP flag must not be changed after the initial setup
that happens during the f_ops-&gt;mmap() hook.

To avoid setting invalid flag values, the methods for clearing VM_MAYWRITE
and similar involve a check of VM_WRITE, and return an error if VM_WRITE
is set.  Trying to use `try_clear_maywrite` without checking the return
value results in a compilation error because the `Result` type is marked
#[must_use].

For now, there's only a method for VM_MIXEDMAP and not VM_PFNMAP.  When we
add a VM_PFNMAP method, we will need some way to prevent you from setting
both VM_MIXEDMAP and VM_PFNMAP on the same vma.

Link: https://lkml.kernel.org/r/20250408-vma-v16-6-d8b446e885d9@google.com
Signed-off-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Acked-by: Lorenzo Stoakes &lt;lorenzo.stoakes@oracle.com&gt;
Acked-by: Liam R. Howlett &lt;Liam.Howlett@Oracle.com&gt;
Reviewed-by: Jann Horn &lt;jannh@google.com&gt;
Reviewed-by: Andreas Hindborg &lt;a.hindborg@kernel.org&gt;
Cc: Alex Gaynor &lt;alex.gaynor@gmail.com&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Balbir Singh &lt;balbirs@nvidia.com&gt;
Cc: Benno Lossin &lt;benno.lossin@proton.me&gt;
Cc: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Gary Guo &lt;gary@garyguo.net&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: John Hubbard &lt;jhubbard@nvidia.com&gt;
Cc: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
Cc: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Cc: Suren Baghdasaryan &lt;surenb@google.com&gt;
Cc: Trevor Gross &lt;tmgross@umich.edu&gt;
Cc: Vlastimil Babka &lt;vbabka@suse.cz&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>mm: rust: add vm_insert_page</title>
<updated>2025-05-12T00:48:24Z</updated>
<author>
<name>Alice Ryhl</name>
<email>aliceryhl@google.com</email>
</author>
<published>2025-04-08T09:22:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bf3d331bb80749542cf299f94c471f611fb113b1'/>
<id>urn:sha1:bf3d331bb80749542cf299f94c471f611fb113b1</id>
<content type='text'>
The vm_insert_page method is only usable on vmas with the VM_MIXEDMAP
flag, so we introduce a new type to keep track of such vmas.

The approach used in this patch assumes that we will not need to encode
many flag combinations in the type.  I don't think we need to encode more
than VM_MIXEDMAP and VM_PFNMAP as things are now.  However, if that
becomes necessary, using generic parameters in a single type would scale
better as the number of flags increases.

Link: https://lkml.kernel.org/r/20250408-vma-v16-3-d8b446e885d9@google.com
Signed-off-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Acked-by: Lorenzo Stoakes &lt;lorenzo.stoakes@oracle.com&gt;
Acked-by: Liam R. Howlett &lt;Liam.Howlett@Oracle.com&gt;
Reviewed-by: Andreas Hindborg &lt;a.hindborg@kernel.org&gt;
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
Cc: Alex Gaynor &lt;alex.gaynor@gmail.com&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Balbir Singh &lt;balbirs@nvidia.com&gt;
Cc: Benno Lossin &lt;benno.lossin@proton.me&gt;
Cc: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Jann Horn &lt;jannh@google.com&gt;
Cc: John Hubbard &lt;jhubbard@nvidia.com&gt;
Cc: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
Cc: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Cc: Suren Baghdasaryan &lt;surenb@google.com&gt;
Cc: Trevor Gross &lt;tmgross@umich.edu&gt;
Cc: Vlastimil Babka &lt;vbabka@suse.cz&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>mm: rust: add vm_area_struct methods that require read access</title>
<updated>2025-05-12T00:48:24Z</updated>
<author>
<name>Alice Ryhl</name>
<email>aliceryhl@google.com</email>
</author>
<published>2025-04-08T09:22:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=040f404b731207935ed644b14bcc2bb8b8488d00'/>
<id>urn:sha1:040f404b731207935ed644b14bcc2bb8b8488d00</id>
<content type='text'>
This adds a type called VmaRef which is used when referencing a vma that
you have read access to.  Here, read access means that you hold either the
mmap read lock or the vma read lock (or stronger).

Additionally, a vma_lookup method is added to the mmap read guard, which
enables you to obtain a &amp;VmaRef in safe Rust code.

This patch only provides a way to lock the mmap read lock, but a follow-up
patch also provides a way to just lock the vma read lock.

Link: https://lkml.kernel.org/r/20250408-vma-v16-2-d8b446e885d9@google.com
Signed-off-by: Alice Ryhl &lt;aliceryhl@google.com&gt;
Acked-by: Lorenzo Stoakes &lt;lorenzo.stoakes@oracle.com&gt;
Acked-by: Liam R. Howlett &lt;Liam.Howlett@Oracle.com&gt;
Reviewed-by: Jann Horn &lt;jannh@google.com&gt;
Reviewed-by: Andreas Hindborg &lt;a.hindborg@kernel.org&gt;
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
Cc: Alex Gaynor &lt;alex.gaynor@gmail.com&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Balbir Singh &lt;balbirs@nvidia.com&gt;
Cc: Benno Lossin &lt;benno.lossin@proton.me&gt;
Cc: Björn Roy Baron &lt;bjorn3_gh@protonmail.com&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: John Hubbard &lt;jhubbard@nvidia.com&gt;
Cc: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
Cc: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Cc: Suren Baghdasaryan &lt;surenb@google.com&gt;
Cc: Trevor Gross &lt;tmgross@umich.edu&gt;
Cc: Vlastimil Babka &lt;vbabka@suse.cz&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
</feed>
