Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: mm: add __rust_helper to helpers

This is needed to inline these helpers into Rust code.

Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Link: https://patch.msgid.link/20260105-define-rust-helper-v2-11-51da5f454a67@google.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Alice Ryhl and committed by
Miguel Ojeda
5092aeaf fa6cbf1f

+16 -15
+10 -10
rust/helpers/mm.c
··· 3 3 #include <linux/mm.h> 4 4 #include <linux/sched/mm.h> 5 5 6 - void rust_helper_mmgrab(struct mm_struct *mm) 6 + __rust_helper void rust_helper_mmgrab(struct mm_struct *mm) 7 7 { 8 8 mmgrab(mm); 9 9 } 10 10 11 - void rust_helper_mmdrop(struct mm_struct *mm) 11 + __rust_helper void rust_helper_mmdrop(struct mm_struct *mm) 12 12 { 13 13 mmdrop(mm); 14 14 } 15 15 16 - void rust_helper_mmget(struct mm_struct *mm) 16 + __rust_helper void rust_helper_mmget(struct mm_struct *mm) 17 17 { 18 18 mmget(mm); 19 19 } 20 20 21 - bool rust_helper_mmget_not_zero(struct mm_struct *mm) 21 + __rust_helper bool rust_helper_mmget_not_zero(struct mm_struct *mm) 22 22 { 23 23 return mmget_not_zero(mm); 24 24 } 25 25 26 - void rust_helper_mmap_read_lock(struct mm_struct *mm) 26 + __rust_helper void rust_helper_mmap_read_lock(struct mm_struct *mm) 27 27 { 28 28 mmap_read_lock(mm); 29 29 } 30 30 31 - bool rust_helper_mmap_read_trylock(struct mm_struct *mm) 31 + __rust_helper bool rust_helper_mmap_read_trylock(struct mm_struct *mm) 32 32 { 33 33 return mmap_read_trylock(mm); 34 34 } 35 35 36 - void rust_helper_mmap_read_unlock(struct mm_struct *mm) 36 + __rust_helper void rust_helper_mmap_read_unlock(struct mm_struct *mm) 37 37 { 38 38 mmap_read_unlock(mm); 39 39 } 40 40 41 - struct vm_area_struct *rust_helper_vma_lookup(struct mm_struct *mm, 42 - unsigned long addr) 41 + __rust_helper struct vm_area_struct * 42 + rust_helper_vma_lookup(struct mm_struct *mm, unsigned long addr) 43 43 { 44 44 return vma_lookup(mm, addr); 45 45 } 46 46 47 - void rust_helper_vma_end_read(struct vm_area_struct *vma) 47 + __rust_helper void rust_helper_vma_end_read(struct vm_area_struct *vma) 48 48 { 49 49 vma_end_read(vma); 50 50 }
+5 -4
rust/helpers/page.c
··· 4 4 #include <linux/highmem.h> 5 5 #include <linux/mm.h> 6 6 7 - struct page *rust_helper_alloc_pages(gfp_t gfp_mask, unsigned int order) 7 + __rust_helper struct page *rust_helper_alloc_pages(gfp_t gfp_mask, 8 + unsigned int order) 8 9 { 9 10 return alloc_pages(gfp_mask, order); 10 11 } 11 12 12 - void *rust_helper_kmap_local_page(struct page *page) 13 + __rust_helper void *rust_helper_kmap_local_page(struct page *page) 13 14 { 14 15 return kmap_local_page(page); 15 16 } 16 17 17 - void rust_helper_kunmap_local(const void *addr) 18 + __rust_helper void rust_helper_kunmap_local(const void *addr) 18 19 { 19 20 kunmap_local(addr); 20 21 } 21 22 22 23 #ifndef NODE_NOT_IN_PAGE_FLAGS 23 - int rust_helper_page_to_nid(const struct page *page) 24 + __rust_helper int rust_helper_page_to_nid(const struct page *page) 24 25 { 25 26 return page_to_nid(page); 26 27 }
+1 -1
rust/helpers/vmalloc.c
··· 2 2 3 3 #include <linux/vmalloc.h> 4 4 5 - void * __must_check __realloc_size(2) 5 + __rust_helper void *__must_check __realloc_size(2) 6 6 rust_helper_vrealloc_node_align(const void *p, size_t size, unsigned long align, 7 7 gfp_t flags, int node) 8 8 {