memcg: add target_mem_cgroup, mem_cgroup fields to shrink_control
Subsystems (4)
RFC PATCH 2/6 memcg: add target_mem_cgroup, mem_cgroup fields to shrink_control
Add target_mem_cgroup and mem_cgroup to shrink_control. The former one is the "root" memcg under pressure, and the latter one is the "current" memcg under pressure.
The target_mem_cgroup is initialized with the scan_control's target_mem_cgroup under target reclaim and default to NULL for rest of the places including global reclaim.
--- include/linux/shrinker.h | 10 ++++++++++ mm/vmscan.c | 1 + 2 files changed, 11 insertions(+), 0 deletions(-)
include/linux/shrinker.h +10 -0
@@ -12,6 +12,16 @@ struct shrink_control {unsigned long nr_to_scan;int priority; +/* +* The memory cgroup that is the primary target of this reclaim. Set to +* NULL during a global reclaim. +*/ +struct mem_cgroup *target_mem_cgroup; +/* +* The memory cgroup that is current being scanned in order to reclaim +* from the hierarchy of mem_cgroup. +*/ +struct mem_cgroup *mem_cgroup; };/*
mm/vmscan.c +1 -0
@@ -2323,6 +2323,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg, };struct shrink_control shrink = { .gfp_mask = sc.gfp_mask, + .target_mem_cgroup = sc.target_mem_cgroup, };/*
Signature · 7 lines
1.7.7.3 -- 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 9 lines · Ying Han
Add
target_mem_cgroupandmem_cgrouptoshrink_control. The former one is the "root" memcg under pressure, and the latter one is the "current" memcg under pressure.The
target_mem_cgroupis initialized with the scan_control'starget_mem_cgroupunder target reclaim and default to NULL for rest of the places including global reclaim.Signed-off-by Ying Han <[email protected]>
Maybe I'll change my mind while I advance in the patchset, but at first, I don't see the point in having two memcg encoded in the shrinker structure. It seems to me we should be able to do this internally from memcg and hide it from the shrinker code.
--
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 9 lines · Glauber Costa
Quoted 8 lines · Ying Han
Add
target_mem_cgroupandmem_cgrouptoshrink_control. The former one is the "root" memcg under pressure, and the latter one is the "current" memcg under pressure.The
target_mem_cgroupis initialized with the scan_control'starget_mem_cgroupunder target reclaim and default to NULL for rest of the places including global reclaim.
Quoted 6 lines
Quoted 1 line
Signed-off-by Ying Han <[email protected]>Maybe I'll change my mind while I advance in the patchset, but at first, I don't see the point in having two memcg encoded in the shrinker structure. It seems to me we should be able to do this internally from memcg and hide it from the shrinker code.
We can do something like scan_control has, and during shrink_zone() passes down the memcg context with lruvec. That is feasible as long as it is necessary.
--Ying
Quoted 3 lines
--
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>