On Thu Feb 26, 2026 at 1:23 PM CET, Andi Shyti wrote:
> On Wed, Feb 25, 2026 at 06:29:12PM +0100, Janusz Krzysztofik wrote:
>> On Wednesday, 25 February 2026 16:38:18 CET Andi Shyti wrote:
>> > > > For clarity this can be written as
>> > > >
>> > > > nr_pages = min_t(unsigned long,
>> > > > folio_nr_pages(folio), page_count - i);
>> > > > nr_pages = min_t(unsigned long, nr_pages, max_pages);
>> > >
>> > > Do you think the min_array() is less clear? Let's see what others say.
>> >
>> > min_array() is clear, it's the ((unsigned long[]) { ... }) that
>> > iis nice and fancy but of difficult first read. But, as I said,
>> > it can stay, I don't have a strong opinion, maybe I'd have done
>> > the same.
>>
>> Would you be more happy with a locally declared unsigned long table,
>> initalized with those 3 values, nr_pages - i and max_segment << PAGE_SHIFT
>> statically, folio_nr_pages(folio) once folio is ready, then passed to
>> min_array()?
>
> mine was only an idea, I'm fine with what it is now if no one has
> anything against it. Perhaps, just a little comment could help
> understand why we are evaluating out of three elements (but we
> are talking trivial details here :) ).
>
> Thanks,
> Andi
There’s also a min3 function, but you’d need to cast the
variables, so using an array is ok in my opinion.
Best regards,
Sebastian