mm: Restore per-memcg proactive reclaim with !CONFIG_NUMA
Subsystems (5)
PATCH 1/1 mm: Restore per-memcg proactive reclaim with !CONFIG_NUMA
Commit 2b7226af730c ("mm/memcg: make memory.reclaim interface generic") moved proactive reclaim logic from memory.reclaim handler to a generic user_proactive_reclaim() helper to be used for per-node proactive reclaim.
However, user_proactive_reclaim() was only defined under CONFIG_NUMA, with a stub always returning 0 otherwise. This broke memory.reclaim on !CONFIG_NUMA configs, causing it to report success without actually attempting reclaim.
Move the definition of user_proactive_reclaim() outside CONFIG_NUMA, and instead define a stub for __node_reclaim() in the !CONFIG_NUMA case. __node_reclaim() is only called from user_proactive_reclaim() when a write is made to sys/devices/system/node/nodeX/reclaim, which is only defined with CONFIG_NUMA.
--- mm/internal.h | 8 -------- mm/vmscan.c | 13 +++++++++++-- 2 files changed, 11 insertions(+), 10 deletions(-)
mm/internal.h +0 -8
@@ -615,16 +615,8 @@ extern unsigned long highest_memmap_pfn;bool folio_isolate_lru (struct folio *folio);void folio_putback_lru (struct folio *folio);extern void reclaim_throttle (pg_data_t *pgdat,enum vmscan_throttle_state reason); -#ifdef CONFIG_NUMA int user_proactive_reclaim (char *buf,struct mem_cgroup *memcg,pg_data_t *pgdat); -#else -static inline int user_proactive_reclaim (char *buf, -struct mem_cgroup *memcg,pg_data_t *pgdat) -{ -return 0 ; -} -#endif /* * in mm/rmap.c:
mm/vmscan.c +11 -2
@@ -7849,6 +7849,17 @@ int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)return ret; } +#else + +static unsigned long __node_reclaim (struct pglist_data *pgdat,gfp_t gfp_mask, +unsigned long nr_pages, +struct scan_control *sc) +{ +return 0 ; +} + +#endif +enum {MEMORY_RECLAIM_SWAPPINESS =0 ,MEMORY_RECLAIM_SWAPPINESS_MAX ,
@@ -7956,8 +7967,6 @@ int user_proactive_reclaim(char *buf,return 0 ; } -#endif -/** * check_move_unevictable_folios - Move evictable folios to appropriate zone * lru list
Signature · 1 line
2.52.0.457.g6b5491de43-goog
Quoted 16 lines · Yosry Ahmed
Commit
2b7226af730c("mm/memcg: make memory.reclaim interface generic") moved proactive reclaim logic from memory.reclaim handler to a genericuser_proactive_reclaim()helper to be used for per-node proactive reclaim.However,
user_proactive_reclaim()was only defined underCONFIG_NUMA, with a stub always returning 0 otherwise. This broke memory.reclaim on !CONFIG_NUMA configs, causing it to report success without actually attempting reclaim.Move the definition of
user_proactive_reclaim()outsideCONFIG_NUMA, and instead define a stub for__node_reclaim()in the !CONFIG_NUMA case.__node_reclaim()is only called fromuser_proactive_reclaim()when a write is made to sys/devices/system/node/nodeX/reclaim, which is only defined withCONFIG_NUMA.
Quoted 3 lines
Fixes 2b7226af730c ("mm/memcg: make memory.reclaim interface generic")Signed-off-by Yosry Ahmed <[email protected]>
Quoted 16 lines · Yosry Ahmed
Commit
2b7226af730c("mm/memcg: make memory.reclaim interface generic") moved proactive reclaim logic from memory.reclaim handler to a genericuser_proactive_reclaim()helper to be used for per-node proactive reclaim.However,
user_proactive_reclaim()was only defined underCONFIG_NUMA, with a stub always returning 0 otherwise. This broke memory.reclaim on !CONFIG_NUMA configs, causing it to report success without actually attempting reclaim.Move the definition of
user_proactive_reclaim()outsideCONFIG_NUMA, and instead define a stub for__node_reclaim()in the !CONFIG_NUMA case.__node_reclaim()is only called fromuser_proactive_reclaim()when a write is made to sys/devices/system/node/nodeX/reclaim, which is only defined withCONFIG_NUMA.
Quoted 3 lines
Fixes 2b7226af730c ("mm/memcg: make memory.reclaim interface generic")Signed-off-by Yosry Ahmed <[email protected]>
Ouch.
Thanks for catching that up.
Quoted 59 lines
--- mm/internal.h | 8 -------- mm/vmscan.c | 13 +++++++++++-- 2 files changed, 11 insertions(+), 10 deletions(-)mm/internal.h +0
-8@@ -615,16 +615,8 @@ extern unsigned long highest_memmap_pfn;bool folio_isolate_lru (struct folio *folio);void folio_putback_lru (struct folio *folio);extern void reclaim_throttle (pg_data_t *pgdat,enum vmscan_throttle_state reason); -#ifdef CONFIG_NUMA int user_proactive_reclaim (char *buf,struct mem_cgroup *memcg,pg_data_t *pgdat); -#else -static inline int user_proactive_reclaim (char *buf, -struct mem_cgroup *memcg,pg_data_t *pgdat) -{ -return 0 ; -} -#endif /* * in mm/rmap.c: mm/vmscan.c +11
-2@@ -7849,6 +7849,17 @@ int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)return ret; } +#else + +static unsigned long __node_reclaim (struct pglist_data *pgdat,gfp_t gfp_mask, +unsigned long nr_pages, +struct scan_control *sc) +{ +return 0 ; +} + +#endif +enum {MEMORY_RECLAIM_SWAPPINESS =0 ,MEMORY_RECLAIM_SWAPPINESS_MAX ,@@ -7956,8 +7967,6 @@ int user_proactive_reclaim(char *buf,return 0 ; } -#endif -/** * check_move_unevictable_folios - Move evictable folios to appropriate zone * lru list Signature · 1 line
2.52.0.457.g6b5491de43-goog
Signature · 2 lines
Michal Hocko SUSE Labs