mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-29 13:23:23 +01:00
dev
10
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0326440c35 |
mm: rename zap_page_range_single() to zap_vma_range()
Let's rename it to make it better match our new naming scheme. While at it, polish the kerneldoc. [[email protected]: fix rustfmtcheck] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: David Hildenbrand (Arm) <[email protected]> Reviewed-by: Lorenzo Stoakes (Oracle) <[email protected]> Acked-by: Puranjay Mohan <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Alice Ryhl <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Arve <[email protected]> Cc: "Borislav Petkov (AMD)" <[email protected]> Cc: Carlos Llamas <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Claudio Imbrenda <[email protected]> Cc: Daniel Borkman <[email protected]> Cc: Dave Airlie <[email protected]> Cc: David Ahern <[email protected]> Cc: David Rientjes <[email protected]> Cc: David S. Miller <[email protected]> Cc: Dimitri Sivanich <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Gerald Schaefer <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Hartley Sweeten <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ian Abbott <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jakub Kacinski <[email protected]> Cc: Jani Nikula <[email protected]> Cc: Jann Horn <[email protected]> Cc: Janosch Frank <[email protected]> Cc: Jarkko Sakkinen <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Jonas Lahtinen <[email protected]> Cc: Leon Romanovsky <[email protected]> Cc: Liam Howlett <[email protected]> Cc: Madhavan Srinivasan <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Namhyung kim <[email protected]> Cc: Neal Cardwell <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Pedro Falcato <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rodrigo Vivi <[email protected]> Cc: Shakeel Butt <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Todd Kjos <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Vincenzo Frascino <[email protected]> Signed-off-by: Andrew Morton <[email protected]> |
||
|
|
de008c9ba5 |
mm/memory: remove "zap_details" parameter from zap_page_range_single()
Nobody except memory.c should really set that parameter to non-NULL. So let's just drop it and make unmap_mapping_range_vma() use zap_page_range_single_batched() instead. [[email protected]: format on a single line] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: David Hildenbrand (Arm) <[email protected]> Reviewed-by: Lorenzo Stoakes (Oracle) <[email protected]> Acked-by: Puranjay Mohan <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Alice Ryhl <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Arve <[email protected]> Cc: "Borislav Petkov (AMD)" <[email protected]> Cc: Carlos Llamas <[email protected]> Cc: Christian Borntraeger <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Claudio Imbrenda <[email protected]> Cc: Daniel Borkman <[email protected]> Cc: Dave Airlie <[email protected]> Cc: David Ahern <[email protected]> Cc: David Rientjes <[email protected]> Cc: David S. Miller <[email protected]> Cc: Dimitri Sivanich <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Gerald Schaefer <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Hartley Sweeten <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Ian Abbott <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jakub Kacinski <[email protected]> Cc: Jani Nikula <[email protected]> Cc: Jann Horn <[email protected]> Cc: Janosch Frank <[email protected]> Cc: Jarkko Sakkinen <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Jonas Lahtinen <[email protected]> Cc: Leon Romanovsky <[email protected]> Cc: Liam Howlett <[email protected]> Cc: Madhavan Srinivasan <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Namhyung kim <[email protected]> Cc: Neal Cardwell <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Pedro Falcato <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rodrigo Vivi <[email protected]> Cc: Shakeel Butt <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Todd Kjos <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Cc: Vasily Gorbik <[email protected]> Cc: Vincenzo Frascino <[email protected]> Signed-off-by: Andrew Morton <[email protected]> |
||
|
|
9ea35a25d5 |
mm: introduce VMA flags bitmap type
It is useful to transition to using a bitmap for VMA flags so we can avoid running out of flags, especially for 32-bit kernels which are constrained to 32 flags, necessitating some features to be limited to 64-bit kernels only. By doing so, we remove any constraint on the number of VMA flags moving forwards no matter the platform and can decide in future to extend beyond 64 if required. We start by declaring an opaque types, vma_flags_t (which resembles mm_struct flags of type mm_flags_t), setting it to precisely the same size as vm_flags_t, and place it in union with vm_flags in the VMA declaration. We additionally update struct vm_area_desc equivalently placing the new opaque type in union with vm_flags. This change therefore does not impact the size of struct vm_area_struct or struct vm_area_desc. In order for the change to be iterative and to avoid impacting performance, we designate VM_xxx declared bitmap flag values as those which must exist in the first system word of the VMA flags bitmap. We therefore declare vma_flags_clear_all(), vma_flags_overwrite_word(), vma_flags_overwrite_word(), vma_flags_overwrite_word_once(), vma_flags_set_word() and vma_flags_clear_word() in order to allow us to update the existing vm_flags_*() functions to utilise these helpers. This is a stepping stone towards converting users to the VMA flags bitmap and behaves precisely as before. By doing this, we can eliminate the existing private vma->__vm_flags field in the vma->vm_flags union and replace it with the newly introduced opaque type vma_flags, which we call flags so we refer to the new bitmap field as vma->flags. We update vma_flag_[test, set]_atomic() to account for the change also. We adapt vm_flags_reset_once() to only clear those bits above the first system word providing write-once semantics to the first system word (which it is presumed the caller requires - and in all current use cases this is so). As we currently only specify that the VMA flags bitmap size is equal to BITS_PER_LONG number of bits, this is a noop, but is defensive in preparation for a future change that increases this. We additionally update the VMA userland test declarations to implement the same changes there. Finally, we update the rust code to reference vma->vm_flags on update rather than vma->__vm_flags which has been removed. This is safe for now, albeit it is implicitly performing a const cast. Once we introduce flag helpers we can improve this more. No functional change intended. Link: https://lkml.kernel.org/r/bab179d7b153ac12f221b7d65caac2759282cfe9.1764064557.git.lorenzo.stoakes@oracle.com Signed-off-by: Lorenzo Stoakes <[email protected]> Acked-by: Vlastimil Babka <[email protected]> Reviewed-by: Pedro Falcato <[email protected]> Acked-by: Alice Ryhl <[email protected]> [rust] Cc: Alex Gaynor <[email protected]> Cc: Alistair Popple <[email protected]> Cc: Andreas Hindborg <[email protected]> Cc: Axel Rasmussen <[email protected]> Cc: Baolin Wang <[email protected]> Cc: Baoquan He <[email protected]> Cc: Barry Song <[email protected]> Cc: Ben Segall <[email protected]> Cc: Björn Roy Baron <[email protected]> Cc: Boqun Feng <[email protected]> Cc: Byungchul Park <[email protected]> Cc: Chengming Zhou <[email protected]> Cc: Chris Li <[email protected]> Cc: Danilo Krummrich <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: David Rientjes <[email protected]> Cc: Dev Jain <[email protected]> Cc: Dietmar Eggemann <[email protected]> Cc: Gary Guo <[email protected]> Cc: Gregory Price <[email protected]> Cc: "Huang, Ying" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jann Horn <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: John Hubbard <[email protected]> Cc: Joshua Hahn <[email protected]> Cc: Juri Lelli <[email protected]> Cc: Kairui Song <[email protected]> Cc: Kees Cook <[email protected]> Cc: Kemeng Shi <[email protected]> Cc: Lance Yang <[email protected]> Cc: Leon Romanovsky <[email protected]> Cc: Liam Howlett <[email protected]> Cc: Mathew Brost <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Mel Gorman <mgorman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Muchun Song <[email protected]> Cc: Nhat Pham <[email protected]> Cc: Nico Pache <[email protected]> Cc: Oscar Salvador <[email protected]> Cc: Peter Xu <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Qi Zheng <[email protected]> Cc: Rakie Kim <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Shakeel Butt <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Trevor Gross <[email protected]> Cc: Valentin Schneider <[email protected]> Cc: Vincent Guittot <[email protected]> Cc: Wei Xu <[email protected]> Cc: xu xin <[email protected]> Cc: Yuanchu Xie <[email protected]> Cc: Zi Yan <[email protected]> Signed-off-by: Andrew Morton <[email protected]> |
||
|
|
9907e1df31 |
rust: mm: update ARef and AlwaysRefCounted imports from sync::aref
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/[email protected] Signed-off-by: Shankari Anand <[email protected]> Suggested-by: Benno Lossin <[email protected]> Link: https://github.com/Rust-for-Linux/linux/issues/1173 Acked-by: Alice Ryhl <[email protected]> Cc: Alex Gaynor <[email protected]> Cc: Andreas Hindborg <[email protected]> Cc: Björn Roy Baron <[email protected]> Cc: Boqun Feng <[email protected]> Cc: Danilo Krummrich <[email protected]> Cc: Gary Guo <[email protected]> Cc: Liam Howlett <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Trevor Gross <[email protected]> Signed-off-by: Andrew Morton <[email protected]> |
||
|
|
5cc5e030bc |
rust: mm: mark VmaNew as transparent
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/[email protected]
Fixes:
|
||
|
|
5e30550558 |
rust: enable clippy::as_underscore lint
In Rust 1.63.0, Clippy introduced the `as_underscore` lint [1]: > The conversion might include lossy conversion or a dangerous cast that > might go undetected due to the type being inferred. > > The lint is allowed by default as using `_` is less wordy than always > 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 <[email protected]> Reviewed-by: Boqun Feng <[email protected]> Signed-off-by: Tamir Duberstein <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Acked-by: Danilo Krummrich <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Changed `isize` to `c_long`. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]> |
||
|
|
5a78977262 |
mm: rust: make CONFIG_MMU ifdefs more narrow
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/[email protected]
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Fixes:
|
||
|
|
dcb81aeab4 |
mm: rust: add VmaNew for f_ops->mmap()
This type will be used when setting up a new vma in an f_ops->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->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/[email protected] Signed-off-by: Alice Ryhl <[email protected]> Acked-by: Lorenzo Stoakes <[email protected]> Acked-by: Liam R. Howlett <[email protected]> Reviewed-by: Jann Horn <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Cc: Alex Gaynor <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Balbir Singh <[email protected]> Cc: Benno Lossin <[email protected]> Cc: Björn Roy Baron <[email protected]> Cc: Boqun Feng <[email protected]> Cc: Gary Guo <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: John Hubbard <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Trevor Gross <[email protected]> Cc: Vlastimil Babka <[email protected]> Signed-off-by: Andrew Morton <[email protected]> |
||
|
|
bf3d331bb8 |
mm: rust: add vm_insert_page
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/[email protected] Signed-off-by: Alice Ryhl <[email protected]> Acked-by: Lorenzo Stoakes <[email protected]> Acked-by: Liam R. Howlett <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Reviewed-by: Gary Guo <[email protected]> Cc: Alex Gaynor <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Balbir Singh <[email protected]> Cc: Benno Lossin <[email protected]> Cc: Björn Roy Baron <[email protected]> Cc: Boqun Feng <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Jann Horn <[email protected]> Cc: John Hubbard <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Trevor Gross <[email protected]> Cc: Vlastimil Babka <[email protected]> Signed-off-by: Andrew Morton <[email protected]> |
||
|
|
040f404b73 |
mm: rust: add vm_area_struct methods that require read access
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 &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/[email protected] Signed-off-by: Alice Ryhl <[email protected]> Acked-by: Lorenzo Stoakes <[email protected]> Acked-by: Liam R. Howlett <[email protected]> Reviewed-by: Jann Horn <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Reviewed-by: Gary Guo <[email protected]> Cc: Alex Gaynor <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Balbir Singh <[email protected]> Cc: Benno Lossin <[email protected]> Cc: Björn Roy Baron <[email protected]> Cc: Boqun Feng <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: John Hubbard <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Miguel Ojeda <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Trevor Gross <[email protected]> Cc: Vlastimil Babka <[email protected]> Signed-off-by: Andrew Morton <[email protected]> |