[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230522132851.ccc9fafac91d7eb9ba922e94@linux-foundation.org>
Date: Mon, 22 May 2023 13:28:51 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Lorenzo Stoakes <lstoakes@...il.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Mike Rapoport <rppt@...nel.org>,
"Liam R . Howlett" <Liam.Howlett@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>
Subject: Re: [PATCH] mm/mmap: refactor mlock_future_check()
On Mon, 22 May 2023 09:24:12 +0100 Lorenzo Stoakes <lstoakes@...il.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(...))
?
Powered by blists - more mailing lists