linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: zenghongling <zenghongling@kylinos.cn>
To: muchun.song@linux.dev, osalvador@suse.de, david@kernel.org,
	akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	zhongling0719@126.com, zenghongling <zenghongling@kylinos.cn>
Subject: [PATCH] mm/hugetlb_vmemmap: Use max() macro to simplify the code
Date: Wed, 21 Jan 2026 09:51:14 +0800	[thread overview]
Message-ID: <20260121015114.560424-1-zenghongling@kylinos.cn> (raw)

Use the max() macro to simplify the function and improve
its readability.

Signed-off-by: zenghongling <zenghongling@kylinos.cn>
---
 mm/hugetlb_vmemmap.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb_vmemmap.h b/mm/hugetlb_vmemmap.h
index 18b490825215..abdfa870b096 100644
--- a/mm/hugetlb_vmemmap.h
+++ b/mm/hugetlb_vmemmap.h
@@ -48,7 +48,7 @@ static inline unsigned int hugetlb_vmemmap_optimizable_size(const struct hstate
 
 	if (!is_power_of_2(sizeof(struct page)))
 		return 0;
-	return size > 0 ? size : 0;
+	return max(size, 0);
 }
 #else
 static inline int hugetlb_vmemmap_restore_folio(const struct hstate *h, struct folio *folio)
-- 
2.25.1



             reply	other threads:[~2026-01-21  1:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21  1:51 zenghongling [this message]
2026-01-21  2:33 ` Muchun Song
2026-01-21  6:17 ` Matthew Wilcox
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=20260121015114.560424-1-zenghongling@kylinos.cn \
    --to=zenghongling@kylinos.cn \
    --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=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