diff options
| author | Suren Baghdasaryan <[email protected]> | 2023-01-31 16:01:16 -0800 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2023-02-09 16:51:41 -0800 |
| commit | 601c3c29dbeb049862faa00917f2daf094a71028 (patch) | |
| tree | 24e4ec4694356281c6ee9e12858f52a889d977da /include/linux | |
| parent | 7e4a32c0e8adafdda6161635c9046e6c1e8b95b5 (diff) | |
mm: introduce vm_flags_reset_once to replace WRITE_ONCE vm_flags updates
Provide vm_flags_reset_once() and replace the vm_flags updates which used
WRITE_ONCE() to prevent compiler optimizations.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 0cce31a0aa0e ("mm: replace vma->vm_flags direct modifications with modifier calls")
Signed-off-by: Suren Baghdasaryan <[email protected]>
Reported-by: Hyeonggon Yoo <[email protected]>
Reviewed-by: Hyeonggon Yoo <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/mm.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 27b34f7730e7..0ed0cb2401f5 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -642,6 +642,13 @@ static inline void vm_flags_reset(struct vm_area_struct *vma, vm_flags_init(vma, flags); } +static inline void vm_flags_reset_once(struct vm_area_struct *vma, + vm_flags_t flags) +{ + mmap_assert_write_locked(vma->vm_mm); + WRITE_ONCE(ACCESS_PRIVATE(vma, __vm_flags), flags); +} + static inline void vm_flags_set(struct vm_area_struct *vma, vm_flags_t flags) { |