[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260121113212.3d685ad2@pumpkin>
Date: Wed, 21 Jan 2026 11:32:12 +0000
From: David Laight <david.laight.linux@...il.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: zenghongling <zenghongling@...inos.cn>, muchun.song@...ux.dev,
osalvador@...e.de, david@...nel.org, akpm@...ux-foundation.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org, zhongling0719@....com
Subject: Re: [PATCH] mm/hugetlb_vmemmap: Use max() macro to simplify the
code
On Wed, 21 Jan 2026 06:17:07 +0000
Matthew Wilcox <willy@...radead.org> wrote:
> On Wed, Jan 21, 2026 at 09:51:14AM +0800, zenghongling wrote:
> > Use the max() macro to simplify the function and improve
> > its readability.
>
> How does this improve readability? I understand what this does in
> the ternary form. I have to think far harder about it in the max()
> form.
I must do a patch for checkpatch.pl to stop it suggesting min/max
for trivial cases.
Oh - and stop it ever suggesting the _t variants.
IMHO it is better to have an explicit cast on one of the parameters.
David
>
> > if (!is_power_of_2(sizeof(struct page)))
> > return 0;
> > - return size > 0 ? size : 0;
> > + return max(size, 0);
> > }
>
Powered by blists - more mailing lists