mm/page_isolation: clarify FIXME around shrink_slab() in memory hotplug
Subsystems (2)
PATCH 1/1 mm/page_isolation: clarify FIXME around shrink_slab() in memory hotplug
The existing FIXME comment notes that memory hotplug doesn't invoke shrink_slab() directly. This patch adds context explaining that this is an intentional design choice to avoid recursion or deadlocks in the memory reclaim path, as slab shrinking is handled by vmscan.
--- mm/page_isolation.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
mm/page_isolation.c +8 -2
@@ -176,10 +176,16 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_/* * FIXME: Now, memory hotplug doesn't call shrink_slab() by itself. -* We just check MOVABLE pages. +* +* This is an intentional limitation: invoking shrink_slab() from a +* hotplug path can cause reclaim recursion or deadlock if the normal +* memory reclaim (vmscan) path is already active. Slab shrinking is +* handled by the vmscan reclaim code under normal operation, so hotplug +* avoids direct calls into shrink_slab() to prevent reentrancy issues. +* +* We therefore only check MOVABLE pages here. * * Pass the intersection of [start_pfn, end_pfn) and the page's pageblock -* to avoid redundant checks. */ check_unmovable_start =max (page_to_pfn (page), start_pfn); check_unmovable_end = min(pageblock_end_pfn(page_to_pfn(page)),
Signature · 1 line
2.43.0
Quoted 15 lines · Manish Kumar
The existing FIXME comment notes that memory hotplug doesn't invoke
shrink_slab()directly. This patch adds context explaining that this is an intentional design choice to avoid recursion or deadlocks in the memory reclaim path, as slab shrinking is handled by vmscan.Signed-off-by Manish Kumar <[email protected]>--- mm/page_isolation.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)mm/page_isolation.c +0
-0
mm/page_isolation.c static int set_migratetype_isolate(struct page *page, int migratetype, int isol_ · line 184
Quoted 10 lines
mm/page_isolation.c +6
-1@@ -176,10 +176,16 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_/* * FIXME: Now, memory hotplug doesn't call shrink_slab() by itself. -* We just check MOVABLE pages. +* +* This is an intentional limitation: invoking shrink_slab() from a +* hotplug path can cause reclaim recursion or deadlock if the normal +* memory reclaim (vmscan) path is already active. Slab shrinking is +* handled by the vmscan reclaim code under normal operation, so hotplug +* avoids direct calls into shrink_slab() to prevent reentrancy issues.
This is the first time I hear about this reentrance issue.
How did you come up with this explanation?
Signature · 3 lines
Cheers David / dhildenb
Andrew Morton
maintainerQuoted 29 lines · On Mon, 20 Oct 2025 21:26:42 +0200 David Hildenbrand <[email protected]> wrote:
Quoted 15 lines · Manish Kumar
The existing FIXME comment notes that memory hotplug doesn't invoke
shrink_slab()directly. This patch adds context explaining that this is an intentional design choice to avoid recursion or deadlocks in the memory reclaim path, as slab shrinking is handled by vmscan.Signed-off-by Manish Kumar <[email protected]>--- mm/page_isolation.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)mm/page_isolation.c +0
-0mm/page_isolation.c static int set_migratetype_isolate(struct page *page, int migratetype, int isol_ · line 184
Quoted 10 lines
mm/page_isolation.c +6
-1@@ -176,10 +176,16 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_/* * FIXME: Now, memory hotplug doesn't call shrink_slab() by itself. -* We just check MOVABLE pages. +* +* This is an intentional limitation: invoking shrink_slab() from a +* hotplug path can cause reclaim recursion or deadlock if the normal +* memory reclaim (vmscan) path is already active. Slab shrinking is +* handled by the vmscan reclaim code under normal operation, so hotplug +* avoids direct calls into shrink_slab() to prevent reentrancy issues. This is the first time I hear about this reentrance issue.
Quoted 2 lines
How did you come up with this explanation?
-ETIMEDOUT, I'll drop this patch.