linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: zenghongling <zenghongling@kylinos.cn>
Cc: muchun.song@linux.dev, osalvador@suse.de, david@kernel.org,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, zhongling0719@126.com
Subject: Re: [PATCH] mm/hugetlb_vmemmap: Use max() macro to simplify the code
Date: Wed, 21 Jan 2026 06:17:07 +0000	[thread overview]
Message-ID: <aXBvY_MjV2GZ0WPN@casper.infradead.org> (raw)
In-Reply-To: <20260121015114.560424-1-zenghongling@kylinos.cn>

On Wed, Jan 21, 2026 at 09:51:14AM +0800, zenghongling wrote:
> Use the max() macro to simplify the function and improve
> its readability.

How does this improve readability?  I understand what this does in
the ternary form.  I have to think far harder about it in the max()
form.

>  	if (!is_power_of_2(sizeof(struct page)))
>  		return 0;
> -	return size > 0 ? size : 0;
> +	return max(size, 0);
>  }


  parent reply	other threads:[~2026-01-21  6:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21  1:51 zenghongling
2026-01-21  2:33 ` Muchun Song
2026-01-21  6:17 ` Matthew Wilcox [this message]
2026-01-21 11:32   ` David Laight

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=aXBvY_MjV2GZ0WPN@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --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