linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/3] Enhance sysfs handling for memory hotplug in weighted interleave
@ 2025-04-02  1:49 Rakie Kim
  2025-04-02  1:49 ` [PATCH v5 1/3] mm/mempolicy: Fix memory leaks in weighted interleave sysfs Rakie Kim
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Rakie Kim @ 2025-04-02  1:49 UTC (permalink / raw)
  To: gourry
  Cc: akpm, linux-mm, linux-kernel, linux-cxl, joshua.hahnjy,
	dan.j.williams, ying.huang, david, Jonathan.Cameron, kernel_team,
	honggyu.kim, yunjeong.mun, rakie.kim

The following patch series enhances the weighted interleave policy in the
memory management subsystem by improving sysfs handling, fixing memory leaks,
and introducing dynamic sysfs updates for memory hotplug support.

### Background
The weighted interleave policy distributes memory allocations across multiple
NUMA nodes based on their performance weight, thereby optimizing memory
bandwidth utilization. The weight values are configured through sysfs.

Previously, sysfs entries for weighted interleave were managed statically
at initialization. This led to several issues:
- Memory Leaks: Improper `kobject` deallocation caused memory leaks
  when initialization failed or when nodes were removed.
- Lack of Dynamic Updates: Sysfs attributes were created only during
  initialization, preventing nodes added at runtime from being recognized.
- Handling of Unusable Nodes: Sysfs entries were generated for all
  possible nodes (`N_POSSIBLE`), including memoryless or unavailable nodes,
  leading to sysfs entries for unusable nodes and potential
  misconfigurations.

### Patch Overview
1. [PATCH 1/3] Fix memory leaks in weighted interleave sysfs
   - Ensures proper cleanup of `kobject` allocations.
   - Replaces unnecessary `kfree()` calls with `kobject_put()`, preventing
     memory leaks and improving system stability.

2. [PATCH 2/3] Enable dynamic updates for weighted interleave sysfs
   - Restructures sysfs handling to allow runtime updates.
   - The sysfs attributes are now globally accessible, enabling external
     modules to manage interleave settings dynamically.

3. [PATCH 3/3] Support memory hotplug in weighted interleave
   - Modifies sysfs creation logic to restrict entries to nodes that are
     online and have memory, excluding unusable nodes.
   - Introduces a memory hotplug mechanism to dynamically add and remove
     sysfs attributes when nodes transition into or out of the `N_MEMORY` set.
   - Ensures that sysfs attributes are properly removed when nodes go offline,
     preventing stale or redundant entries from persisting.

These patches have been tested under CXL-based memory configurations,
including hotplug scenarios, to ensure proper behavior and stability.

 mm/mempolicy.c | 192 +++++++++++++++++++++++++++++++------------------
 1 file changed, 124 insertions(+), 68 deletions(-)


base-commit: 38fec10eb60d687e30c8c6b5420d86e8149f7557
-- 
2.34.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2025-04-03  5:45 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-02  1:49 [PATCH v5 0/3] Enhance sysfs handling for memory hotplug in weighted interleave Rakie Kim
2025-04-02  1:49 ` [PATCH v5 1/3] mm/mempolicy: Fix memory leaks in weighted interleave sysfs Rakie Kim
2025-04-02  1:49 ` [PATCH v5 2/3] mm/mempolicy: Support dynamic sysfs updates for weighted interleave Rakie Kim
2025-04-02  1:49 ` [PATCH v5 3/3] mm/mempolicy: Support memory hotplug in " Rakie Kim
2025-04-02  4:18   ` Honggyu Kim
2025-04-02  4:34     ` Andrew Morton
2025-04-02  5:15       ` Gregory Price
2025-04-02  5:23         ` Gregory Price
2025-04-02  5:32         ` Honggyu Kim
2025-04-02  9:51   ` Oscar Salvador
2025-04-02 14:14     ` Gregory Price
2025-04-02 15:41       ` Oscar Salvador
2025-04-02 16:36         ` Gregory Price
2025-04-03  4:26           ` Rakie Kim
2025-04-03  5:45             ` Rakie Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox