]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm/pagewalk: use min() to simplify the code
authorzenghongling <zenghongling@kylinos.cn>
Tue, 20 Jan 2026 09:49:32 +0000 (17:49 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 31 Jan 2026 22:22:52 +0000 (14:22 -0800)
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 <zenghongling@kylinos.cn>
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
Cc: Hongling Zeng <zenghongling@kylinos.cn>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/pagewalk.c

index 90cc346a6ecf162d12f3de47a996563b619fdb56..a94c401ab2cfe41cab015560729f7f7718390b63 100644 (file)
@@ -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,