mm: make vma_merge() and split_vma() internal
Now the common pattern of - attempting a merge via vma_merge() and should this fail splitting VMAs via split_vma() - has been abstracted, the former can be placed into mm/internal.h and the latter made static. In addition, the split_vma() nommu variant also need not be exported. Link: https://lkml.kernel.org/r/405f2be10e20c4e9fbcc9fe6b2dfea105f6642e0.1697043508.git.lstoakes@gmail.com Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Christian Brauner <brauner@kernel.org> Cc: Liam R. Howlett <Liam.Howlett@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>pull/318/merge
parent
94d7d92339
commit
adb20b0c78
|
|
@ -3235,16 +3235,7 @@ extern int vma_expand(struct vma_iterator *vmi, struct vm_area_struct *vma,
|
||||||
struct vm_area_struct *next);
|
struct vm_area_struct *next);
|
||||||
extern int vma_shrink(struct vma_iterator *vmi, struct vm_area_struct *vma,
|
extern int vma_shrink(struct vma_iterator *vmi, struct vm_area_struct *vma,
|
||||||
unsigned long start, unsigned long end, pgoff_t pgoff);
|
unsigned long start, unsigned long end, pgoff_t pgoff);
|
||||||
extern struct vm_area_struct *vma_merge(struct vma_iterator *vmi,
|
|
||||||
struct mm_struct *, struct vm_area_struct *prev, unsigned long addr,
|
|
||||||
unsigned long end, unsigned long vm_flags, struct anon_vma *,
|
|
||||||
struct file *, pgoff_t, struct mempolicy *, struct vm_userfaultfd_ctx,
|
|
||||||
struct anon_vma_name *);
|
|
||||||
extern struct anon_vma *find_mergeable_anon_vma(struct vm_area_struct *);
|
extern struct anon_vma *find_mergeable_anon_vma(struct vm_area_struct *);
|
||||||
extern int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *,
|
|
||||||
unsigned long addr, int new_below);
|
|
||||||
extern int split_vma(struct vma_iterator *vmi, struct vm_area_struct *,
|
|
||||||
unsigned long addr, int new_below);
|
|
||||||
extern int insert_vm_struct(struct mm_struct *, struct vm_area_struct *);
|
extern int insert_vm_struct(struct mm_struct *, struct vm_area_struct *);
|
||||||
extern void unlink_file_vma(struct vm_area_struct *);
|
extern void unlink_file_vma(struct vm_area_struct *);
|
||||||
extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
|
extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
|
||||||
|
|
|
||||||
|
|
@ -1002,6 +1002,15 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
|
||||||
unsigned long addr, pmd_t *pmd,
|
unsigned long addr, pmd_t *pmd,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* mm/mmap.c
|
||||||
|
*/
|
||||||
|
struct vm_area_struct *vma_merge(struct vma_iterator *vmi,
|
||||||
|
struct mm_struct *, struct vm_area_struct *prev, unsigned long addr,
|
||||||
|
unsigned long end, unsigned long vm_flags, struct anon_vma *,
|
||||||
|
struct file *, pgoff_t, struct mempolicy *, struct vm_userfaultfd_ctx,
|
||||||
|
struct anon_vma_name *);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
/* mark page accessed */
|
/* mark page accessed */
|
||||||
FOLL_TOUCH = 1 << 16,
|
FOLL_TOUCH = 1 << 16,
|
||||||
|
|
|
||||||
|
|
@ -2346,8 +2346,8 @@ static void unmap_region(struct mm_struct *mm, struct ma_state *mas,
|
||||||
* has already been checked or doesn't make sense to fail.
|
* has already been checked or doesn't make sense to fail.
|
||||||
* VMA Iterator will point to the end VMA.
|
* VMA Iterator will point to the end VMA.
|
||||||
*/
|
*/
|
||||||
int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma,
|
static int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma,
|
||||||
unsigned long addr, int new_below)
|
unsigned long addr, int new_below)
|
||||||
{
|
{
|
||||||
struct vma_prepare vp;
|
struct vma_prepare vp;
|
||||||
struct vm_area_struct *new;
|
struct vm_area_struct *new;
|
||||||
|
|
@ -2428,8 +2428,8 @@ out_free_vma:
|
||||||
* Split a vma into two pieces at address 'addr', a new vma is allocated
|
* Split a vma into two pieces at address 'addr', a new vma is allocated
|
||||||
* either for the first part or the tail.
|
* either for the first part or the tail.
|
||||||
*/
|
*/
|
||||||
int split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma,
|
static int split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma,
|
||||||
unsigned long addr, int new_below)
|
unsigned long addr, int new_below)
|
||||||
{
|
{
|
||||||
if (vma->vm_mm->map_count >= sysctl_max_map_count)
|
if (vma->vm_mm->map_count >= sysctl_max_map_count)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
|
||||||
|
|
@ -1305,8 +1305,8 @@ SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg)
|
||||||
* split a vma into two pieces at address 'addr', a new vma is allocated either
|
* split a vma into two pieces at address 'addr', a new vma is allocated either
|
||||||
* for the first part or the tail.
|
* for the first part or the tail.
|
||||||
*/
|
*/
|
||||||
int split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma,
|
static int split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma,
|
||||||
unsigned long addr, int new_below)
|
unsigned long addr, int new_below)
|
||||||
{
|
{
|
||||||
struct vm_area_struct *new;
|
struct vm_area_struct *new;
|
||||||
struct vm_region *region;
|
struct vm_region *region;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue