diff options
author | Liam R. Howlett <Liam.Howlett@oracle.com> | 2023-07-24 14:31:51 -0400 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-08-18 10:12:49 -0700 |
commit | f72cf24a868675280bc555e95abc3639777f8d82 (patch) | |
tree | 22775af1b1baa0e176b7afd5e3681a1f57587049 /mm/internal.h | |
parent | c108df767fb786586274b2435473885151d6f360 (diff) |
mm: use vma_iter_clear_gfp() in nommu
Move the definition of vma_iter_clear_gfp() from mmap.c to internal.h so
it can be used in the nommu code. This will reduce node preallocations
in nommu.
Link: https://lkml.kernel.org/r/20230724183157.3939892-10-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/internal.h')
-rw-r--r-- | mm/internal.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mm/internal.h b/mm/internal.h index 65f646c2ccf3..2f35c0ef7b7f 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1064,6 +1064,18 @@ static inline void vma_iter_clear(struct vma_iterator *vmi, mas_store_prealloc(&vmi->mas, NULL); } +static inline int vma_iter_clear_gfp(struct vma_iterator *vmi, + unsigned long start, unsigned long end, gfp_t gfp) +{ + vmi->mas.index = start; + vmi->mas.last = end - 1; + mas_store_gfp(&vmi->mas, NULL, gfp); + if (unlikely(mas_is_err(&vmi->mas))) + return -ENOMEM; + + return 0; +} + static inline struct vm_area_struct *vma_iter_load(struct vma_iterator *vmi) { return mas_walk(&vmi->mas); |