From: Vlastimil Babka <vbabka@suse.cz>
To: Lorenzo Stoakes <lstoakes@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Rapoport <rppt@kernel.org>,
"Liam R . Howlett" <Liam.Howlett@Oracle.com>
Subject: Re: [PATCH] mm/mmap: refactor mlock_future_check()
Date: Tue, 23 May 2023 15:13:43 +0200 [thread overview]
Message-ID: <856dbc05-5046-04c8-cf6f-9d0b13e9d229@suse.cz> (raw)
In-Reply-To: <20230522082412.56685-1-lstoakes@gmail.com>
On 5/22/23 10:24, Lorenzo Stoakes 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.
>
> Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> mm/internal.h | 4 ++--
> mm/mmap.c | 33 +++++++++++++++++----------------
> mm/mremap.c | 2 +-
> mm/secretmem.c | 2 +-
> 4 files changed, 21 insertions(+), 20 deletions(-)
>
> diff --git a/mm/internal.h b/mm/internal.h
> index bb6542279599..66dd214b302a 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -576,8 +576,8 @@ extern long populate_vma_page_range(struct vm_area_struct *vma,
> extern long faultin_vma_page_range(struct vm_area_struct *vma,
> unsigned long start, unsigned long end,
> bool write, int *locked);
> -extern int mlock_future_check(struct mm_struct *mm, unsigned long flags,
> - unsigned long len);
> +extern bool mlock_future_check(struct mm_struct *mm, unsigned long flags,
> + unsigned long bytes);
This would have been good opportunity to drop the extern.
prev parent reply other threads:[~2023-05-23 13:14 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
2023-05-22 20:56 ` Andrew Morton
2023-05-23 13:13 ` Vlastimil Babka [this message]
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=856dbc05-5046-04c8-cf6f-9d0b13e9d229@suse.cz \
--to=vbabka@suse.cz \
--cc=Liam.Howlett@Oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lstoakes@gmail.com \
--cc=rppt@kernel.org \
/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