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

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

 



On Mon, May 22, 2023 at 01:28:51PM -0700, Andrew Morton wrote:
> 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(...))
>
> ?
>
>

Yeah I struggled with this, because the check only triggers if VM_LOCKED. I was
originally toying with can_mlock_future() but of course, it also returns true if
!VM_LOCKED...

I think your suggestion of mlock_future_ok() works well, could you change it to
that? Thanks!




[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