mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-06 05:06:29 +00:00
mm: move vma_modify() and helpers to internal header
These are core VMA manipulation functions which invoke VMA splitting and merging and should not be directly accessed from outside of mm/. Link: https://lkml.kernel.org/r/5efde0c6342a8860d5ffc90b415f3989fd8ed0b2.1722251717.git.lorenzo.stoakes@oracle.com Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Brendan Higgins <brendanhiggins@google.com> Cc: Christian Brauner <brauner@kernel.org> Cc: David Gow <davidgow@google.com> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Jan Kara <jack@suse.cz> Cc: Kees Cook <kees@kernel.org> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Rae Moar <rmoar@google.com> Cc: SeongJae Park <sj@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Pengfei Xu <pengfei.xu@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
a17c7d8fd2
commit
fa04c08f3c
@ -3279,66 +3279,6 @@ extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
|
|||||||
unsigned long addr, unsigned long len, pgoff_t pgoff,
|
unsigned long addr, unsigned long len, pgoff_t pgoff,
|
||||||
bool *need_rmap_locks);
|
bool *need_rmap_locks);
|
||||||
extern void exit_mmap(struct mm_struct *);
|
extern void exit_mmap(struct mm_struct *);
|
||||||
struct vm_area_struct *vma_modify(struct vma_iterator *vmi,
|
|
||||||
struct vm_area_struct *prev,
|
|
||||||
struct vm_area_struct *vma,
|
|
||||||
unsigned long start, unsigned long end,
|
|
||||||
unsigned long vm_flags,
|
|
||||||
struct mempolicy *policy,
|
|
||||||
struct vm_userfaultfd_ctx uffd_ctx,
|
|
||||||
struct anon_vma_name *anon_name);
|
|
||||||
|
|
||||||
/* We are about to modify the VMA's flags. */
|
|
||||||
static inline struct vm_area_struct
|
|
||||||
*vma_modify_flags(struct vma_iterator *vmi,
|
|
||||||
struct vm_area_struct *prev,
|
|
||||||
struct vm_area_struct *vma,
|
|
||||||
unsigned long start, unsigned long end,
|
|
||||||
unsigned long new_flags)
|
|
||||||
{
|
|
||||||
return vma_modify(vmi, prev, vma, start, end, new_flags,
|
|
||||||
vma_policy(vma), vma->vm_userfaultfd_ctx,
|
|
||||||
anon_vma_name(vma));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We are about to modify the VMA's flags and/or anon_name. */
|
|
||||||
static inline struct vm_area_struct
|
|
||||||
*vma_modify_flags_name(struct vma_iterator *vmi,
|
|
||||||
struct vm_area_struct *prev,
|
|
||||||
struct vm_area_struct *vma,
|
|
||||||
unsigned long start,
|
|
||||||
unsigned long end,
|
|
||||||
unsigned long new_flags,
|
|
||||||
struct anon_vma_name *new_name)
|
|
||||||
{
|
|
||||||
return vma_modify(vmi, prev, vma, start, end, new_flags,
|
|
||||||
vma_policy(vma), vma->vm_userfaultfd_ctx, new_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We are about to modify the VMA's memory policy. */
|
|
||||||
static inline struct vm_area_struct
|
|
||||||
*vma_modify_policy(struct vma_iterator *vmi,
|
|
||||||
struct vm_area_struct *prev,
|
|
||||||
struct vm_area_struct *vma,
|
|
||||||
unsigned long start, unsigned long end,
|
|
||||||
struct mempolicy *new_pol)
|
|
||||||
{
|
|
||||||
return vma_modify(vmi, prev, vma, start, end, vma->vm_flags,
|
|
||||||
new_pol, vma->vm_userfaultfd_ctx, anon_vma_name(vma));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We are about to modify the VMA's flags and/or uffd context. */
|
|
||||||
static inline struct vm_area_struct
|
|
||||||
*vma_modify_flags_uffd(struct vma_iterator *vmi,
|
|
||||||
struct vm_area_struct *prev,
|
|
||||||
struct vm_area_struct *vma,
|
|
||||||
unsigned long start, unsigned long end,
|
|
||||||
unsigned long new_flags,
|
|
||||||
struct vm_userfaultfd_ctx new_ctx)
|
|
||||||
{
|
|
||||||
return vma_modify(vmi, prev, vma, start, end, new_flags,
|
|
||||||
vma_policy(vma), new_ctx, anon_vma_name(vma));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int check_data_rlimit(unsigned long rlim,
|
static inline int check_data_rlimit(unsigned long rlim,
|
||||||
unsigned long new,
|
unsigned long new,
|
||||||
|
@ -1244,6 +1244,67 @@ struct vm_area_struct *vma_merge_extend(struct vma_iterator *vmi,
|
|||||||
struct vm_area_struct *vma,
|
struct vm_area_struct *vma,
|
||||||
unsigned long delta);
|
unsigned long delta);
|
||||||
|
|
||||||
|
struct vm_area_struct *vma_modify(struct vma_iterator *vmi,
|
||||||
|
struct vm_area_struct *prev,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
|
unsigned long start, unsigned long end,
|
||||||
|
unsigned long vm_flags,
|
||||||
|
struct mempolicy *policy,
|
||||||
|
struct vm_userfaultfd_ctx uffd_ctx,
|
||||||
|
struct anon_vma_name *anon_name);
|
||||||
|
|
||||||
|
/* We are about to modify the VMA's flags. */
|
||||||
|
static inline struct vm_area_struct
|
||||||
|
*vma_modify_flags(struct vma_iterator *vmi,
|
||||||
|
struct vm_area_struct *prev,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
|
unsigned long start, unsigned long end,
|
||||||
|
unsigned long new_flags)
|
||||||
|
{
|
||||||
|
return vma_modify(vmi, prev, vma, start, end, new_flags,
|
||||||
|
vma_policy(vma), vma->vm_userfaultfd_ctx,
|
||||||
|
anon_vma_name(vma));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We are about to modify the VMA's flags and/or anon_name. */
|
||||||
|
static inline struct vm_area_struct
|
||||||
|
*vma_modify_flags_name(struct vma_iterator *vmi,
|
||||||
|
struct vm_area_struct *prev,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
|
unsigned long start,
|
||||||
|
unsigned long end,
|
||||||
|
unsigned long new_flags,
|
||||||
|
struct anon_vma_name *new_name)
|
||||||
|
{
|
||||||
|
return vma_modify(vmi, prev, vma, start, end, new_flags,
|
||||||
|
vma_policy(vma), vma->vm_userfaultfd_ctx, new_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We are about to modify the VMA's memory policy. */
|
||||||
|
static inline struct vm_area_struct
|
||||||
|
*vma_modify_policy(struct vma_iterator *vmi,
|
||||||
|
struct vm_area_struct *prev,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
|
unsigned long start, unsigned long end,
|
||||||
|
struct mempolicy *new_pol)
|
||||||
|
{
|
||||||
|
return vma_modify(vmi, prev, vma, start, end, vma->vm_flags,
|
||||||
|
new_pol, vma->vm_userfaultfd_ctx, anon_vma_name(vma));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We are about to modify the VMA's flags and/or uffd context. */
|
||||||
|
static inline struct vm_area_struct
|
||||||
|
*vma_modify_flags_uffd(struct vma_iterator *vmi,
|
||||||
|
struct vm_area_struct *prev,
|
||||||
|
struct vm_area_struct *vma,
|
||||||
|
unsigned long start, unsigned long end,
|
||||||
|
unsigned long new_flags,
|
||||||
|
struct vm_userfaultfd_ctx new_ctx)
|
||||||
|
{
|
||||||
|
return vma_modify(vmi, prev, vma, start, end, new_flags,
|
||||||
|
vma_policy(vma), new_ctx, anon_vma_name(vma));
|
||||||
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
/* mark page accessed */
|
/* mark page accessed */
|
||||||
FOLL_TOUCH = 1 << 16,
|
FOLL_TOUCH = 1 << 16,
|
||||||
|
Loading…
Reference in New Issue
Block a user