mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
mm/mlock: rename mlock_future_check() to mlock_future_ok()
It is felt that the name mlock_future_check() is vague - it doesn't particularly convey the function's operation. mlock_future_ok() is a clearer name for a predicate function. Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Liam Howlett <liam.howlett@oracle.com> Cc: Lorenzo Stoakes <lstoakes@gmail.com> Cc: Mike Rapoport (IBM) <rppt@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
@@ -576,7 +576,7 @@ extern long populate_vma_page_range(struct vm_area_struct *vma,
|
|||||||
extern long faultin_vma_page_range(struct vm_area_struct *vma,
|
extern long faultin_vma_page_range(struct vm_area_struct *vma,
|
||||||
unsigned long start, unsigned long end,
|
unsigned long start, unsigned long end,
|
||||||
bool write, int *locked);
|
bool write, int *locked);
|
||||||
extern bool mlock_future_check(struct mm_struct *mm, unsigned long flags,
|
extern bool mlock_future_ok(struct mm_struct *mm, unsigned long flags,
|
||||||
unsigned long bytes);
|
unsigned long bytes);
|
||||||
/*
|
/*
|
||||||
* mlock_vma_folio() and munlock_vma_folio():
|
* mlock_vma_folio() and munlock_vma_folio():
|
||||||
|
@@ -182,7 +182,7 @@ static int check_brk_limits(unsigned long addr, unsigned long len)
|
|||||||
if (IS_ERR_VALUE(mapped_addr))
|
if (IS_ERR_VALUE(mapped_addr))
|
||||||
return mapped_addr;
|
return mapped_addr;
|
||||||
|
|
||||||
return mlock_future_check(current->mm, current->mm->def_flags, len)
|
return mlock_future_ok(current->mm, current->mm->def_flags, len)
|
||||||
? 0 : -EAGAIN;
|
? 0 : -EAGAIN;
|
||||||
}
|
}
|
||||||
static int do_brk_flags(struct vma_iterator *vmi, struct vm_area_struct *brkvma,
|
static int do_brk_flags(struct vma_iterator *vmi, struct vm_area_struct *brkvma,
|
||||||
@@ -1146,7 +1146,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint)
|
|||||||
return hint;
|
return hint;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mlock_future_check(struct mm_struct *mm, unsigned long flags,
|
bool mlock_future_ok(struct mm_struct *mm, unsigned long flags,
|
||||||
unsigned long bytes)
|
unsigned long bytes)
|
||||||
{
|
{
|
||||||
unsigned long locked_pages, limit_pages;
|
unsigned long locked_pages, limit_pages;
|
||||||
@@ -1272,7 +1272,7 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
|
|||||||
if (!can_do_mlock())
|
if (!can_do_mlock())
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
if (!mlock_future_check(mm, vm_flags, len))
|
if (!mlock_future_ok(mm, vm_flags, len))
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
@@ -1890,7 +1890,7 @@ static int acct_stack_growth(struct vm_area_struct *vma,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* mlock limit tests */
|
/* mlock limit tests */
|
||||||
if (!mlock_future_check(mm, vma->vm_flags, grow << PAGE_SHIFT))
|
if (!mlock_future_ok(mm, vma->vm_flags, grow << PAGE_SHIFT))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* Check to ensure the stack will not grow into a hugetlb-only region */
|
/* Check to ensure the stack will not grow into a hugetlb-only region */
|
||||||
|
@@ -775,7 +775,7 @@ static struct vm_area_struct *vma_to_resize(unsigned long addr,
|
|||||||
if (vma->vm_flags & (VM_DONTEXPAND | VM_PFNMAP))
|
if (vma->vm_flags & (VM_DONTEXPAND | VM_PFNMAP))
|
||||||
return ERR_PTR(-EFAULT);
|
return ERR_PTR(-EFAULT);
|
||||||
|
|
||||||
if (!mlock_future_check(mm, vma->vm_flags, new_len - old_len))
|
if (!mlock_future_ok(mm, vma->vm_flags, new_len - old_len))
|
||||||
return ERR_PTR(-EAGAIN);
|
return ERR_PTR(-EAGAIN);
|
||||||
|
|
||||||
if (!may_expand_vm(mm, vma->vm_flags,
|
if (!may_expand_vm(mm, vma->vm_flags,
|
||||||
|
@@ -125,7 +125,7 @@ static int secretmem_mmap(struct file *file, struct vm_area_struct *vma)
|
|||||||
if ((vma->vm_flags & (VM_SHARED | VM_MAYSHARE)) == 0)
|
if ((vma->vm_flags & (VM_SHARED | VM_MAYSHARE)) == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!mlock_future_check(vma->vm_mm, vma->vm_flags | VM_LOCKED, len))
|
if (!mlock_future_ok(vma->vm_mm, vma->vm_flags | VM_LOCKED, len))
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
|
|
||||||
vm_flags_set(vma, VM_LOCKED | VM_DONTDUMP);
|
vm_flags_set(vma, VM_LOCKED | VM_DONTDUMP);
|
||||||
|
Reference in New Issue
Block a user