[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251106085645.13607-1-swarajgaikwad1925@gmail.com>
Date: Thu, 6 Nov 2025 08:56:41 +0000
From: Swaraj Gaikwad <swarajgaikwad1925@...il.com>
To: Muchun Song <muchun.song@...ux.dev>,
Oscar Salvador <osalvador@...e.de>,
David Hildenbrand <david@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-mm@...ck.org (open list:HUGETLB SUBSYSTEM),
linux-kernel@...r.kernel.org (open list)
Cc: skhan@...uxfoundation.org,
david.hunter.linux@...il.com,
Swaraj Gaikwad <swarajgaikwad1925@...il.com>
Subject: [RFC] hugetlb: add memory-hotplug notifier to only allocate for online nodes
This patch is a RFC on a proposed change to the hugetlb cgroup subsystem’s
css allocation function.
The existing hugetlb_cgroup_css_alloc() uses for_each_node() to allocate
nodeinfo for all nodes, including those which are not online yet
(or never will be). This can waste considerable memory on large-node systems.
The documentation already lists this as a TODO.
Proposed Change:
Introduce a memory hotplug notifier that listens for MEM_ONLINE
events. When a node becomes online, we call the same allocation function
but insted of for_each_node(),using for_each_online_node(). This means
memory is only allocated for nodes which are online, thus reducing waste.
Feedback Requested:
- Where in the codebase (which file or section) is it most appropriate to
implement and register the memory hotplug notifier for this subsystem?
- Are there best practices or patterns for handling the notifier lifecycle,
especially for unregistering during cgroup or subsystem teardown?
- What are the standard methods or tools to test memory hotplug scenarios
for cgroups? Are there ways to reliably trigger node online/offline events
in a development environment?
- Are there existing test cases or utilities in the kernel tree that would help
to verify correct behavior of this change?
- Any suggestions for implementation improvements or cleaner API usage?
Thanks,
Swaraj Gaikwad <swarajgaikwad1925@...il.com>
Signed-off-by: Swaraj Gaikwad <swarajgaikwad1925@...il.com>
Powered by blists - more mailing lists