Skip to content

Commit 16aca2c

Browse files
yosrym93akpm00
authored andcommitted
mm: restore per-memcg proactive reclaim with !CONFIG_NUMA
Commit 2b7226a ("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. Link: https://lkml.kernel.org/r/20260116205247.928004-1-yosry.ahmed@linux.dev Fixes: 2b7226a ("mm/memcg: make memory.reclaim interface generic") Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev> Acked-by: Shakeel Butt <shakeel.butt@linux.dev> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Axel Rasmussen <axelrasmussen@google.com> Cc: David Hildenbrand <david@kernel.org> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Liam Howlett <liam.howlett@oracle.com> Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Qi Zheng <zhengqi.arch@bytedance.com> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Wei Xu <weixugc@google.com> Cc: Yuanchu Xie <yuanchu@google.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 9bc9ccb commit 16aca2c

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

mm/internal.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -538,16 +538,8 @@ extern unsigned long highest_memmap_pfn;
538538
bool folio_isolate_lru(struct folio *folio);
539539
void folio_putback_lru(struct folio *folio);
540540
extern void reclaim_throttle(pg_data_t *pgdat, enum vmscan_throttle_state reason);
541-
#ifdef CONFIG_NUMA
542541
int user_proactive_reclaim(char *buf,
543542
struct mem_cgroup *memcg, pg_data_t *pgdat);
544-
#else
545-
static inline int user_proactive_reclaim(char *buf,
546-
struct mem_cgroup *memcg, pg_data_t *pgdat)
547-
{
548-
return 0;
549-
}
550-
#endif
551543

552544
/*
553545
* in mm/rmap.c:

mm/vmscan.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7707,6 +7707,17 @@ int node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned int order)
77077707
return ret;
77087708
}
77097709

7710+
#else
7711+
7712+
static unsigned long __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask,
7713+
unsigned long nr_pages,
7714+
struct scan_control *sc)
7715+
{
7716+
return 0;
7717+
}
7718+
7719+
#endif
7720+
77107721
enum {
77117722
MEMORY_RECLAIM_SWAPPINESS = 0,
77127723
MEMORY_RECLAIM_SWAPPINESS_MAX,
@@ -7814,8 +7825,6 @@ int user_proactive_reclaim(char *buf,
78147825
return 0;
78157826
}
78167827

7817-
#endif
7818-
78197828
/**
78207829
* check_move_unevictable_folios - Move evictable folios to appropriate zone
78217830
* lru list

0 commit comments

Comments
 (0)