Re: [PATCH v2] mm: folio_zero_user: open code range computation in folio_zero_user()
From: David Hildenbrand (Arm)
Date: Thu Feb 05 2026 - 07:36:39 EST
On 2/5/26 06:48, Ankur Arora wrote:
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> writes:
On Wed, 4 Feb 2026 22:01:42 +0100 "David Hildenbrand (arm)" <david@xxxxxxxxxx> wrote:
I'm late, maybe this is already upstream.
It's in mm-unstable. The second round of MM upstreaming is two weeks hence.
TBH, without the clamp that looks much more readable here.
me too.
Is that cast really required?
Seems not. The types for nr_pages are a bit chaotic - u64->long->uint.
Yes agreed.
The first u64 is because currently struct range only supports that.
Then the cast to signed long is because the range can be negative
and the clear_contig_highpages() is only done if nr_pages > 0.
That makes sense to me.
And, the third one is almost certainly unnecessary for any realistic
hugepage size but since nr_pages is being truncating, I wanted that
to be explicit.
But the non-silent truncation is no better? IOW, it doesn't matter.
You could just make clear_contig_highpages() consume an unsigned long ...
--
Cheers,
David