mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lstoakes@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Mike Rapoport <rppt@kernel.org>,
	"Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH] mm/mmap: refactor mlock_future_check()
Date: Mon, 22 May 2023 21:34:31 +0100	[thread overview]
Message-ID: <fbbba8cd-77d1-44c3-ba70-18beae5719d1@lucifer.local> (raw)
In-Reply-To: <20230522132851.ccc9fafac91d7eb9ba922e94@linux-foundation.org>

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@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(...))
>
> ?
>
>

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!

  reply	other threads:[~2023-05-22 20:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22  8:24 Lorenzo Stoakes
2023-05-22 20:28 ` Andrew Morton
2023-05-22 20:34   ` Lorenzo Stoakes [this message]
2023-05-22 20:56     ` Andrew Morton
2023-05-23 13:13 ` Vlastimil Babka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fbbba8cd-77d1-44c3-ba70-18beae5719d1@lucifer.local \
    --to=lstoakes@gmail.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@kernel.org \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®