[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aJk2IygsxWKYf17u@casper.infradead.org>
Date: Mon, 11 Aug 2025 01:15:31 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: Muchun Song <muchun.song@...ux.dev>, Oscar Salvador <osalvador@...e.de>,
David Hildenbrand <david@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/hugetlb: Use max() to simplify
hugetlb_vmemmap_optimizable_size()
On Sun, Aug 10, 2025 at 11:47:45PM +0200, Thorsten Blum wrote:
> Use max() to simplify hugetlb_vmemmap_optimizable_size() and improve its
> readability.
That ... isn't clearer.
> {
> - int size = hugetlb_vmemmap_size(h) - HUGETLB_VMEMMAP_RESERVE_SIZE;
> -
> if (!is_power_of_2(sizeof(struct page)))
> return 0;
> - return size > 0 ? size : 0;
> +
> + return max(0, hugetlb_vmemmap_size(h) - HUGETLB_VMEMMAP_RESERVE_SIZE);
> }
Powered by blists - more mailing lists