FROMGIT: mm: uninline the main body of vma_start_write()
vma_start_write() is used in many places and will grow in size very soon. It is not used in performance critical paths and uninlining it should limit the future code size growth. No functional changes. Link: https://lkml.kernel.org/r/20250213224655.1680278-10-surenb@google.com Signed-off-by: Suren Baghdasaryan <surenb@google.com> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Tested-by: Shivank Garg <shivankg@amd.com> Link: https://lkml.kernel.org/r/5e19ec93-8307-47c2-bb13-3ddf7150624e@amd.com Cc: Christian Brauner <brauner@kernel.org> Cc: David Hildenbrand <david@redhat.com> Cc: David Howells <dhowells@redhat.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Hillf Danton <hdanton@sina.com> Cc: Hugh Dickins <hughd@google.com> Cc: Jann Horn <jannh@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Klara Modin <klarasmodin@gmail.com> Cc: Liam R. Howlett <Liam.Howlett@Oracle.com> Cc: Lokesh Gidra <lokeshgidra@google.com> Cc: Mateusz Guzik <mjguzik@gmail.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Michal Hocko <mhocko@suse.com> Cc: Minchan Kim <minchan@google.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Pasha Tatashin <pasha.tatashin@soleen.com> Cc: "Paul E . McKenney" <paulmck@kernel.org> Cc: Peter Xu <peterx@redhat.com> Cc: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Shakeel Butt <shakeel.butt@linux.dev> Cc: Sourav Panda <souravpanda@google.com> Cc: Wei Yang <richard.weiyang@gmail.com> Cc: Will Deacon <will@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> (cherry picked from commit b18eb04cebae1b22ea6380c64c2ba65216e1e8b6 https: //git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable) Bug: 322132947 Change-Id: I5ed47a39202909ecf5c7602835b46821ed88c08b Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
committed by
Giuliano Procida
parent
5fcab29750
commit
8bb60ef928
+3
-9
@@ -774,6 +774,8 @@ static bool __is_vma_write_locked(struct vm_area_struct *vma, unsigned int *mm_l
|
||||
return (vma->vm_lock_seq == *mm_lock_seq);
|
||||
}
|
||||
|
||||
void __vma_start_write(struct vm_area_struct *vma, unsigned int mm_lock_seq);
|
||||
|
||||
/*
|
||||
* Begin writing to a VMA.
|
||||
* Exclude concurrent readers under the per-VMA lock until the currently
|
||||
@@ -786,15 +788,7 @@ static inline void vma_start_write(struct vm_area_struct *vma)
|
||||
if (__is_vma_write_locked(vma, &mm_lock_seq))
|
||||
return;
|
||||
|
||||
down_write(&vma->vm_lock.lock);
|
||||
/*
|
||||
* We should use WRITE_ONCE() here because we can have concurrent reads
|
||||
* from the early lockless pessimistic check in vma_start_read().
|
||||
* We don't really care about the correctness of that early check, but
|
||||
* we should use WRITE_ONCE() for cleanliness and to keep KCSAN happy.
|
||||
*/
|
||||
WRITE_ONCE(vma->vm_lock_seq, mm_lock_seq);
|
||||
up_write(&vma->vm_lock.lock);
|
||||
__vma_start_write(vma, mm_lock_seq);
|
||||
}
|
||||
|
||||
static inline void vma_assert_write_locked(struct vm_area_struct *vma)
|
||||
|
||||
+14
@@ -6234,6 +6234,20 @@ fail:
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PER_VMA_LOCK
|
||||
void __vma_start_write(struct vm_area_struct *vma, unsigned int mm_lock_seq)
|
||||
{
|
||||
down_write(&vma->vm_lock.lock);
|
||||
/*
|
||||
* We should use WRITE_ONCE() here because we can have concurrent reads
|
||||
* from the early lockless pessimistic check in vma_start_read().
|
||||
* We don't really care about the correctness of that early check, but
|
||||
* we should use WRITE_ONCE() for cleanliness and to keep KCSAN happy.
|
||||
*/
|
||||
WRITE_ONCE(vma->vm_lock_seq, mm_lock_seq);
|
||||
up_write(&vma->vm_lock.lock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__vma_start_write);
|
||||
|
||||
/*
|
||||
* Lookup and lock a VMA under RCU protection. Returned VMA is guaranteed to be
|
||||
* stable and not isolated. If the VMA is not found or is being modified the
|
||||
|
||||
Reference in New Issue
Block a user