From: David Hildenbrand <david@redhat.com>
To: Thorsten Blum <thorsten.blum@toblux.com>,
jglisse@redhat.com, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib: test_hmm: Use min() to improve dmirror_exclusive()
Date: Thu, 1 Aug 2024 11:33:18 +0200 [thread overview]
Message-ID: <01e36e70-4e3e-464f-a14b-57a892b07f61@redhat.com> (raw)
In-Reply-To: <20240726131245.161695-1-thorsten.blum@toblux.com>
On 26.07.24 15:12, Thorsten Blum wrote:
> Use min() to simplify the dmirror_exclusive() function and improve its
> readability.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
> ---
> lib/test_hmm.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/lib/test_hmm.c b/lib/test_hmm.c
> index ee20e1f9bae9..056f2e411d7b 100644
> --- a/lib/test_hmm.c
> +++ b/lib/test_hmm.c
> @@ -799,10 +799,7 @@ static int dmirror_exclusive(struct dmirror *dmirror,
> unsigned long mapped = 0;
> int i;
>
> - if (end < addr + (ARRAY_SIZE(pages) << PAGE_SHIFT))
> - next = end;
> - else
> - next = addr + (ARRAY_SIZE(pages) << PAGE_SHIFT);
> + next = min(end, addr + (ARRAY_SIZE(pages) << PAGE_SHIFT));
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
parent reply other threads:[~2024-08-01 9:33 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20240726131245.161695-1-thorsten.blum@toblux.com>]
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=01e36e70-4e3e-464f-a14b-57a892b07f61@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=jglisse@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=thorsten.blum@toblux.com \
/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;
as well as URLs for NNTP newsgroup(s).