linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_alloc: simplify lowmem_reserve max calculation
@ 2025-08-14  9:00 Ye Liu
  2025-08-14 14:07 ` Johannes Weiner
  2025-08-14 14:47 ` Zi Yan
  0 siblings, 2 replies; 7+ messages in thread
From: Ye Liu @ 2025-08-14  9:00 UTC (permalink / raw)
  To: Andrew Morton, Vlastimil Babka
  Cc: Ye Liu, Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
	Johannes Weiner, Zi Yan, linux-mm, linux-kernel

From: Ye Liu <liuye@kylinos.cn>

Use max() macro to simplify the calculation of maximum lowmem_reserve
value in calculate_totalreserve_pages(), instead of open-coding the
comparison. The functionality remains identical.

Signed-off-by: Ye Liu <liuye@kylinos.cn>
---
 mm/page_alloc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 64872214bc7d..8a55a4951d19 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6236,8 +6236,7 @@ static void calculate_totalreserve_pages(void)
 
 			/* Find valid and maximum lowmem_reserve in the zone */
 			for (j = i; j < MAX_NR_ZONES; j++) {
-				if (zone->lowmem_reserve[j] > max)
-					max = zone->lowmem_reserve[j];
+				max = max(max, zone->lowmem_reserve[j]);
 			}
 
 			/* we treat the high watermark as reserved pages. */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-08-15  2:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-14  9:00 [PATCH] mm/page_alloc: simplify lowmem_reserve max calculation Ye Liu
2025-08-14 14:07 ` Johannes Weiner
2025-08-15  1:59   ` Ye Liu
2025-08-15  2:01     ` Zi Yan
2025-08-14 14:47 ` Zi Yan
2025-08-15  1:38   ` Ye Liu
2025-08-15  1:59     ` Zi Yan

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).