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

From: Alice Ryhl

Date: Mon Mar 30 2026 - 04:11:44 EST


On Fri, Mar 27, 2026 at 11:37:58AM -0700, Andrew Morton wrote:
> On Fri, 27 Mar 2026 15:18:36 +0530 Shivam Kalra via B4 Relay <devnull+shivamkalra98.zohomail.in@xxxxxxxxxx> wrote:
>
> > This series implements the TODO in vrealloc() to unmap and free unused
> > pages when shrinking across a page boundary.
>
> Thanks. I'd prefer to defer this until the next -rc cycle
> (https://lkml.kernel.org/r/20260323202941.08ddf2b0411501cae801ab4c@xxxxxxxxxxxxxxxxxxxx).
> If Ulad would prefer that we push ahead then OK.

That's fine. No rush from my side.

> Are we able to describe how much memory this change might save under
> various scenarios? If the savings are impressively large then that
> would get attention.

The primary purpose of this is to ensure that this scenario is not
possible:

* There is a global list in the Binder driver. It's an array allocated
using kvmalloc and resized on demand using kvrealloc.
* A process decides to add a bajillion elements to that global list.
* The process exits, taking its entries with it.
* The global list now remains extremely large for no good reason.

I don't know if it would save a significant amount of memory for
well-behaved programs.

Alice