diff options
author | Lorenzo Stoakes <lstoakes@gmail.com> | 2023-05-22 09:24:12 +0100 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-06-09 16:25:38 -0700 |
commit | 3c54a298db4c6b38bbd5f86216ce0f5ad4596ccf (patch) | |
tree | 5b271d9b7546de6c17915cedc65018d99d8d4ebd /mm/internal.h | |
parent | 89207c669bbf464c81e1561d8206f120a679aaf7 (diff) | |
download | linux-stable-3c54a298db4c6b38bbd5f86216ce0f5ad4596ccf.tar.gz linux-stable-3c54a298db4c6b38bbd5f86216ce0f5ad4596ccf.tar.bz2 linux-stable-3c54a298db4c6b38bbd5f86216ce0f5ad4596ccf.zip |
mm/mmap: refactor mlock_future_check()
In all but one instance, mlock_future_check() is treated as a boolean
function despite returning an error code. In one instance, this error
code is ignored and replaced with -ENOMEM.
This is confusing, and the inversion of true -> failure, false -> success
is not warranted. Convert the function to a bool, lightly refactor and
return true if the check passes, false if not.
Link: https://lkml.kernel.org/r/20230522082412.56685-1-lstoakes@gmail.com
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Mike Rapoport (IBM) <rppt@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/internal.h')
-rw-r--r-- | mm/internal.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/internal.h b/mm/internal.h index bb6542279599..66dd214b302a 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -576,8 +576,8 @@ extern long populate_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, bool write, int *locked); -extern int mlock_future_check(struct mm_struct *mm, unsigned long flags, - unsigned long len); +extern bool mlock_future_check(struct mm_struct *mm, unsigned long flags, + unsigned long bytes); /* * mlock_vma_folio() and munlock_vma_folio(): * should be called with vma's mmap_lock held for read or write, |