Re: [PATCH] mm/mmap: refactor mlock_future_check()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

Acked-by: Vlastimil Babka <vbabka@xxxxxxx>

> ---
>  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.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux