linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "David Hildenbrand (Red Hat)" <david@kernel.org>
To: zenghongling <zenghongling@kylinos.cn>,
	akpm@linux-foundation.org, lorenzo.stoakes@oracle.com,
	Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org,
	surenb@google.com, mhocko@suse.com
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	zhongling0719@126.com, Sahil Chandna <chandna.sahil@gmail.com>
Subject: Re: [PATCH] mm/pagewalk: use min() to simplify the code
Date: Wed, 21 Jan 2026 13:05:36 +0100	[thread overview]
Message-ID: <39f4490a-d713-44a8-a1d7-3568b01b3dc2@kernel.org> (raw)
In-Reply-To: <20260120094932.183697-1-zenghongling@kylinos.cn>

On 1/20/26 10:49, zenghongling wrote:
> Use the min() macro to simplify the function and improve
> its readability.
> 
> Signed-off-by: zenghongling <zenghongling@kylinos.cn>
> ---
>   mm/pagewalk.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/pagewalk.c b/mm/pagewalk.c
> index 9f91cf85a5be..82db421b5b34 100644
> --- a/mm/pagewalk.c
> +++ b/mm/pagewalk.c
> @@ -313,7 +313,7 @@ static unsigned long hugetlb_entry_end(struct hstate *h, unsigned long addr,
>   				       unsigned long end)
>   {
>   	unsigned long boundary = (addr & huge_page_mask(h)) + huge_page_size(h);
> -	return boundary < end ? boundary : end;
> +	return min(boundary, end);

There was a length discussion recently about changing this code:

https://lore.kernel.org/linux-mm/35ab82f052d248c0047c10bf01853e37e4f9b4e4.1764312627.git.chandna.sahil@gmail.com/

Changing the min only LGTM.

Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>

-- 
Cheers

David


      parent reply	other threads:[~2026-01-21 12:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20  9:49 zenghongling
2026-01-20 10:41 ` Lorenzo Stoakes
2026-01-21 12:05 ` David Hildenbrand (Red Hat) [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=39f4490a-d713-44a8-a1d7-3568b01b3dc2@kernel.org \
    --to=david@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=chandna.sahil@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=zenghongling@kylinos.cn \
    --cc=zhongling0719@126.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