lkml.org 
[lkml]   [2023]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] mm/mmap: refactor mlock_future_check()
From
On 5/22/23 10:24, Lorenzo Stoakes wrote:
> 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.
>
> Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> ---
> mm/internal.h | 4 ++--
> mm/mmap.c | 33 +++++++++++++++++----------------
> mm/mremap.c | 2 +-
> mm/secretmem.c | 2 +-
> 4 files changed, 21 insertions(+), 20 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);

This would have been good opportunity to drop the extern.

\
 
 \ /
  Last update: 2023-05-23 15:14    [W:0.089 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site