Re: [PATCH 1/9] mm/rmap: make nr_pages signed in try_to_unmap_one

From: Dev Jain

Date: Wed Mar 11 2026 - 00:55:04 EST




On 10/03/26 6:10 pm, Matthew Wilcox wrote:
> On Tue, Mar 10, 2026 at 01:53:21PM +0530, Dev Jain wrote:
>> So when I was playing around with the code, I noticed that passing
>> unsigned int nr_pages to add_mm_counter(-nr_pages) messes up things. Then
>
> Using int (whether signed or unsigned) to store nr_pages is a bad idea.
> Look how many people are asking about supporting PUD-sized folios.
> On an ARM 64k PAGE_SIZE machine, that's 2^26 pages which is uncomfortably
> close to 2^32. It'll only take one more level to exceed that, so, what,
> five to ten more years?
>
> Just use unsigned long everywhere now and save ourselves the grief later.

Thanks, let us do this.