From: Laveesh Bansal <laveeshb@laveeshbansal.com>
To: dakr@kernel.org
Cc: linux-mm@kvack.org
Subject: vrealloc() shrink TODO
Date: Tue, 6 Jan 2026 23:48:39 +0000 [thread overview]
Message-ID: <20260106234839.586018-1-laveeshb@laveeshbansal.com> (raw)
Hi Danilo,
I came across the TODO you left in vrealloc_node_align_noprof() (mm/vmalloc.c:4317) about shrinking the vm_area when reallocating to a smaller size. I'd like to work on this if it's still relevant.
I wanted to check if this approach makes sense: keep the virtual address range unchanged, unmap pages from the end using vunmap_range(), free them, and update nr_pages and memcg accounting. This would avoid vmap_area allocator complexity while still reclaiming physical memory.
One thing I'm not sure about: for huge page allocations (page_order > 0), partial unmapping seems problematic - should shrink just be skipped in that case?
A few questions:
1. Is this optimization still wanted?
2. Does the approach above make sense, or is there a better way?
3. Any preference on the shrink heuristic?
4. Anything else I should watch out for?
Thanks,
Laveesh
reply other threads:[~2026-01-06 23:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260106234839.586018-1-laveeshb@laveeshbansal.com \
--to=laveeshb@laveeshbansal.com \
--cc=dakr@kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox