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

Yup.

I don't think the name does a good job of conveying the
function's use.

> - if (mlock_future_check(mm, vm_flags, len))
> + if (!mlock_future_check(mm, vm_flags, len))
> return -EAGAIN;

if (!may_mlock_future(...))

or

if (!mlock_future_ok(...))

?


\
 
 \ /
  Last update: 2023-05-22 22:32    [W:0.060 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site