Skip to contentSkip to conversation

mm: vmscan: fix memcg-aware shrinkers not called on global reclaim

PATCH Applied Vladimir Davydov 5 participants 7 messages Aug 1, 2016 – Aug 2, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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.

Fixes d71df22b55099 ("mm, vmscan: begin reclaiming pages on a per-node basis")
---
 mm/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vmscan.c +1 -1
index 650d26832569..374d95d04178 100644
@@ -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>
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Vladimir Davydov

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.

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

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
index 650d26832569..374d95d04178 100644
@@ -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>
#2 lore raw
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 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.

Fixes d71df22b55099 ("mm, vmscan: begin reclaiming pages on a per-node basis")

I guess you meant b2e18757f2c9. I do not see d71df22b55099 anywhere.

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

The fix looks ok to me otherwise

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>

reviewer
#3 lore raw
Quoted 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 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.

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 see d71df22b55099 anywhere.

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>
maintainer Acked-by on v1 1/1
#4 lore raw
In reply to Vladimir Davydov
Quoted 8 lines · Vladimir Davydov

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.

Fixes d71df22b55099 ("mm, vmscan: begin reclaiming pages on a per-node basis")

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>

Acked-by on v1 1/1
#5 lore raw
In reply to Vladimir Davydov
Quoted 8 lines · Vladimir Davydov

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.

Fixes d71df22b55099 ("mm, vmscan: begin reclaiming pages on a per-node basis")

--
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>

Acked-by on v1 1/1
#6 lore raw
In reply to Vladimir Davydov
Quoted 8 lines · Vladimir Davydov

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.

Fixes d71df22b55099 ("mm, vmscan: begin reclaiming pages on a per-node basis")
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>