vm_ops: rename .split() callback to .may_split()
Rename the callback to reflect that it's not called *on* or *after* split, but rather some time before the splitting to check if it's possible. Link: https://lkml.kernel.org/r/20201013013416.390574-5-dima@arista.com Signed-off-by: Dmitry Safonov <dima@arista.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Andy Lutomirski <luto@kernel.org> Cc: Brian Geffon <bgeffon@google.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Hugh Dickins <hughd@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: John Hubbard <jhubbard@nvidia.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Ralph Campbell <rcampbell@nvidia.com> Cc: Russell King <linux@armlinux.org.uk> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vishal Verma <vishal.l.verma@intel.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Will Deacon <will@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Juhyung Park <qkrwngud825@gmail.com> Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
This commit is contained in:
parent
c514876628
commit
533031e688
@ -449,7 +449,7 @@ static vm_fault_t dev_dax_fault(struct vm_fault *vmf)
|
|||||||
return dev_dax_huge_fault(vmf, PE_SIZE_PTE);
|
return dev_dax_huge_fault(vmf, PE_SIZE_PTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_dax_split(struct vm_area_struct *vma, unsigned long addr)
|
static int dev_dax_may_split(struct vm_area_struct *vma, unsigned long addr)
|
||||||
{
|
{
|
||||||
struct file *filp = vma->vm_file;
|
struct file *filp = vma->vm_file;
|
||||||
struct dev_dax *dev_dax = filp->private_data;
|
struct dev_dax *dev_dax = filp->private_data;
|
||||||
@ -472,7 +472,7 @@ static unsigned long dev_dax_pagesize(struct vm_area_struct *vma)
|
|||||||
static const struct vm_operations_struct dax_vm_ops = {
|
static const struct vm_operations_struct dax_vm_ops = {
|
||||||
.fault = dev_dax_fault,
|
.fault = dev_dax_fault,
|
||||||
.huge_fault = dev_dax_huge_fault,
|
.huge_fault = dev_dax_huge_fault,
|
||||||
.split = dev_dax_split,
|
.may_split = dev_dax_may_split,
|
||||||
.pagesize = dev_dax_pagesize,
|
.pagesize = dev_dax_pagesize,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -409,7 +409,8 @@ enum page_entry_size {
|
|||||||
struct vm_operations_struct {
|
struct vm_operations_struct {
|
||||||
void (*open)(struct vm_area_struct * area);
|
void (*open)(struct vm_area_struct * area);
|
||||||
void (*close)(struct vm_area_struct * area);
|
void (*close)(struct vm_area_struct * area);
|
||||||
int (*split)(struct vm_area_struct * area, unsigned long addr);
|
/* Called any time before splitting to check if it's allowed */
|
||||||
|
int (*may_split)(struct vm_area_struct *area, unsigned long addr);
|
||||||
int (*mremap)(struct vm_area_struct * area);
|
int (*mremap)(struct vm_area_struct * area);
|
||||||
vm_fault_t (*fault)(struct vm_fault *vmf);
|
vm_fault_t (*fault)(struct vm_fault *vmf);
|
||||||
vm_fault_t (*huge_fault)(struct vm_fault *vmf,
|
vm_fault_t (*huge_fault)(struct vm_fault *vmf,
|
||||||
|
@ -526,13 +526,13 @@ static vm_fault_t shm_fault(struct vm_fault *vmf)
|
|||||||
return sfd->vm_ops->fault(vmf);
|
return sfd->vm_ops->fault(vmf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int shm_split(struct vm_area_struct *vma, unsigned long addr)
|
static int shm_may_split(struct vm_area_struct *vma, unsigned long addr)
|
||||||
{
|
{
|
||||||
struct file *file = vma->vm_file;
|
struct file *file = vma->vm_file;
|
||||||
struct shm_file_data *sfd = shm_file_data(file);
|
struct shm_file_data *sfd = shm_file_data(file);
|
||||||
|
|
||||||
if (sfd->vm_ops->split)
|
if (sfd->vm_ops->may_split)
|
||||||
return sfd->vm_ops->split(vma, addr);
|
return sfd->vm_ops->may_split(vma, addr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -674,7 +674,7 @@ static const struct vm_operations_struct shm_vm_ops = {
|
|||||||
.open = shm_open, /* callback for a new vm-area open */
|
.open = shm_open, /* callback for a new vm-area open */
|
||||||
.close = shm_close, /* callback for when the vm-area is released */
|
.close = shm_close, /* callback for when the vm-area is released */
|
||||||
.fault = shm_fault,
|
.fault = shm_fault,
|
||||||
.split = shm_split,
|
.may_split = shm_may_split,
|
||||||
.pagesize = shm_pagesize,
|
.pagesize = shm_pagesize,
|
||||||
#if defined(CONFIG_NUMA)
|
#if defined(CONFIG_NUMA)
|
||||||
.set_policy = shm_set_policy,
|
.set_policy = shm_set_policy,
|
||||||
|
@ -3253,7 +3253,7 @@ const struct vm_operations_struct hugetlb_vm_ops = {
|
|||||||
.fault = hugetlb_vm_op_fault,
|
.fault = hugetlb_vm_op_fault,
|
||||||
.open = hugetlb_vm_op_open,
|
.open = hugetlb_vm_op_open,
|
||||||
.close = hugetlb_vm_op_close,
|
.close = hugetlb_vm_op_close,
|
||||||
.split = hugetlb_vm_op_split,
|
.may_split = hugetlb_vm_op_split,
|
||||||
.pagesize = hugetlb_vm_op_pagesize,
|
.pagesize = hugetlb_vm_op_pagesize,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2716,8 +2716,8 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
|
|||||||
struct vm_area_struct *new;
|
struct vm_area_struct *new;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (vma->vm_ops && vma->vm_ops->split) {
|
if (vma->vm_ops && vma->vm_ops->may_split) {
|
||||||
err = vma->vm_ops->split(vma, addr);
|
err = vma->vm_ops->may_split(vma, addr);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user