From 57fdfd64238ee4ff9b2cf62d61714d94dd6ebc3d Mon Sep 17 00:00:00 2001 From: zenghongling Date: Tue, 20 Jan 2026 17:49:32 +0800 Subject: [PATCH] mm/pagewalk: use min() to simplify the code Use the min() macro to simplify the function and improve its readability. [akpm@linux-foundation.org: add newline, per Lorenzo] Link: https://lkml.kernel.org/r/20260120094932.183697-1-zenghongling@kylinos.cn Signed-off-by: zenghongling Acked-by: David Hildenbrand (Red Hat) Cc: Hongling Zeng Cc: Liam Howlett Cc: Lorenzo Stoakes Cc: Michal Hocko Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Vlastimil Babka Signed-off-by: Andrew Morton --- mm/pagewalk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 90cc346a6ecf1..a94c401ab2cfe 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -313,7 +313,8 @@ 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); } static int walk_hugetlb_range(unsigned long addr, unsigned long end, -- 2.47.3