mm: vmscan: fix memcg-aware shrinkers not called on global reclaim
Subsystems (3)
PATCH 1/1 mm: vmscan: fix memcg-aware shrinkers not called on global reclaim
We must call shrink_slab() for each memory cgroup on both global and memcg reclaim in shrink_node_memcg(). Commit d71df22b55099 accidentally changed that so that now shrink_slab() is only called with memcg != NULL on memcg reclaim. As a result, memcg-aware shrinkers (including dentry/inode) are never invoked on global reclaim. Fix that.
--- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vmscan.c +1 -1
@@ -2561,7 +2561,7 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)shrink_node_memcg (pgdat, memcg, sc, &lru_pages); node_lru_pages += lru_pages; -if (!global_reclaim (sc)) +if (memcg)shrink_slab (sc->gfp_mask, pgdat->node_id, memcg, sc->nr_scanned - scanned, lru_pages);
Signature · 7 lines
2.1.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 7 lines · Vladimir Davydov
We must call
shrink_slab()for each memory cgroup on both global and memcg reclaim inshrink_node_memcg(). Commitd71df22b55099accidentally changed that so that nowshrink_slab()is only called with memcg != NULL on memcg reclaim. As a result, memcg-aware shrinkers (including dentry/inode) are never invoked on global reclaim. Fix that.Fixes d71df22b55099 ("mm, vmscan: begin reclaiming pages on a per-node basis")
I guess you meant b2e18757f2c9. I do not see d71df22b55099 anywhere.
Quoted 1 line
Signed-off-by Vladimir Davydov <[email protected]>
The fix looks ok to me otherwise
Quoted 25 lines
--- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/vmscan.c +1
-1@@ -2561,7 +2561,7 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)shrink_node_memcg (pgdat, memcg, sc, &lru_pages); node_lru_pages += lru_pages; -if (!global_reclaim (sc)) +if (memcg)shrink_slab (sc->gfp_mask, pgdat->node_id, memcg, sc->nr_scanned - scanned, lru_pages);Signature · 7 lines
2.1.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · Michal Hocko
Quoted 7 lines · Vladimir Davydov
We must call
shrink_slab()for each memory cgroup on both global and memcg reclaim inshrink_node_memcg(). Commitd71df22b55099accidentally changed that so that nowshrink_slab()is only called with memcg != NULL on memcg reclaim. As a result, memcg-aware shrinkers (including dentry/inode) are never invoked on global reclaim. Fix that.Fixes d71df22b55099 ("mm, vmscan: begin reclaiming pages on a per-node basis")I guess you meant
b2e18757f2c9. I do not seed71df22b55099anywhere.
I'm basing on top of v4.7-mmotm-2016-07-28-16-33 and there it's d71df22b55099.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Vladimir Davydov <[email protected]>The fix looks ok to me otherwise
Acked-by Michal Hocko <[email protected]>
Thanks!
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Michal Hocko
reviewerQuoted 8 lines · Vladimir Davydov
Quoted 7 lines · Michal Hocko
Quoted 6 lines · Vladimir Davydov
We must call
shrink_slab()for each memory cgroup on both global and memcg reclaim inshrink_node_memcg(). Commitd71df22b55099accidentally changed that so that nowshrink_slab()is only called with memcg != NULL on memcg reclaim. As a result, memcg-aware shrinkers (including dentry/inode) are never invoked on global reclaim. Fix that.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Fixes d71df22b55099 ("mm, vmscan: begin reclaiming pages on a per-node basis")I guess you meant
b2e18757f2c9. I do not seed71df22b55099anywhere.I'm basing on top of v4.7-mmotm-2016-07-28-16-33 and there it's
d71df22b55099.
But this sha is unstable. THe patch you are referring to is already sitting in the Linus tree so please use his (stable sha instead).
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 8 lines · Vladimir Davydov
We must call
shrink_slab()for each memory cgroup on both global and memcg reclaim inshrink_node_memcg(). Commitd71df22b55099accidentally changed that so that nowshrink_slab()is only called with memcg != NULL on memcg reclaim. As a result, memcg-aware shrinkers (including dentry/inode) are never invoked on global reclaim. Fix that.Fixes d71df22b55099 ("mm, vmscan: begin reclaiming pages on a per-node basis")Signed-off-by Vladimir Davydov <[email protected]>
Ouch, I missed that in the review. The change looked so obviously correct, but the shrink_slab() interface is a little deceiving. It would be great if shrink_slab() could handle root_mem_cgroup/NULL and then we'd always call it from inside the loop. But AFAICS we need the global call to get the cumulative scanned/lru_pages ratio from all of the memcgs reclaimed... grr. Oh well.
This fix looks correct to me, anyway.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 8 lines · Vladimir Davydov
We must call
shrink_slab()for each memory cgroup on both global and memcg reclaim inshrink_node_memcg(). Commitd71df22b55099accidentally changed that so that nowshrink_slab()is only called with memcg != NULL on memcg reclaim. As a result, memcg-aware shrinkers (including dentry/inode) are never invoked on global reclaim. Fix that.Fixes d71df22b55099 ("mm, vmscan: begin reclaiming pages on a per-node basis")Signed-off-by Vladimir Davydov <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 8 lines · Vladimir Davydov
We must call
shrink_slab()for each memory cgroup on both global and memcg reclaim inshrink_node_memcg(). Commitd71df22b55099accidentally changed that so that nowshrink_slab()is only called with memcg != NULL on memcg reclaim. As a result, memcg-aware shrinkers (including dentry/inode) are never invoked on global reclaim. Fix that.Fixes d71df22b55099 ("mm, vmscan: begin reclaiming pages on a per-node basis")Signed-off-by Vladimir Davydov <[email protected]>
Signature · 8 lines
Mel Gorman SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>