On Mon, 22 May 2023 09:24:12 +0100 Lorenzo Stoakes <lstoakes@xxxxxxxxx> 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(...)) ?