Re: [PATCH v10 0/4] mm/vmalloc: free unused pages on vrealloc() shrink

From: Shivam Kalra

Date: Fri Apr 17 2026 - 13:35:59 EST


On 17/04/26 22:54, Uladzislau Rezki wrote:
I have some questions to clarify.

Why should we use min()?
Checking vm->nr_pages, can it be 0?

Can we just do:

if (vm)
/* Can not use get_vm_area_size() because of realloc(). */
size = vm->nr_pages << PAGE_SHIFT;
else
size = va_size(va);

or i am missing something?

Thanks!

--
Uladzislau Rezki
I honestly don't know much about the usage
of this function, so wanted to be cautious.

1. We can skip the usage of min though.
2. Do need (size_t) for overflow issue

I can include this simple version with size_t,
let me know your thoughts.