Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1346008 > unrolled thread
| Started by | Vladimir Davydov <vdavydov@virtuozzo.com> |
|---|---|
| First post | 2016-02-29 18:20 +0100 |
| Last post | 2016-02-29 22:00 +0100 |
| Articles | 4 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH] mm: memcontrol: reset memory.low on css offline Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-02-29 18:20 +0100
Re: [PATCH] mm: memcontrol: reset memory.low on css offline Michal Hocko <mhocko@kernel.org> - 2016-02-29 19:30 +0100
Re: [PATCH] mm: memcontrol: reset memory.low on css offline Johannes Weiner <hannes@cmpxchg.org> - 2016-02-29 21:10 +0100
Re: [PATCH] mm: memcontrol: reset memory.low on css offline Tejun Heo <tj@kernel.org> - 2016-02-29 22:00 +0100
| From | Vladimir Davydov <vdavydov@virtuozzo.com> |
|---|---|
| Date | 2016-02-29 18:20 +0100 |
| Subject | [PATCH] mm: memcontrol: reset memory.low on css offline |
| Message-ID | <r7zEe-5WZ-9@gated-at.bofh.it> |
When a cgroup directory is removed, the memory cgroup subsys state does not disappear immediately. Instead, it's left hanging around until the last reference to it is gone, which implies reclaiming all pages from its lruvec. In the unified hierarchy, there's the memory.low knob, which can be used to set a best-effort protection for a memory cgroup - the reclaimer first scans those cgroups whose consumption is above memory.low, and only if it fails to reclaim enough pages, it gets to the rest. Currently this protection is not reset when the cgroup directory is removed. As a result, if a dead memory cgroup has a lot of page cache charged to it and a high value of memory.low, it will result in higher pressure exerted on live cgroups, and userspace will have no ways to detect such consumers and reconfigure memory.low properly. To fix this, let's reset memory.low on css offline. Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com> --- mm/memcontrol.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index ae8b81c55685..ab7bfe870c7d 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4214,6 +4214,8 @@ static void mem_cgroup_css_offline(struct cgroup_subsys_state *css) memcg_offline_kmem(memcg); wb_memcg_offline(memcg); + + memcg->low = 0; } static void mem_cgroup_css_released(struct cgroup_subsys_state *css) -- 2.1.4
[toc] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2016-02-29 19:30 +0100 |
| Message-ID | <r7AJY-6Ab-17@gated-at.bofh.it> |
| In reply to | #1346008 |
On Mon 29-02-16 20:16:33, Vladimir Davydov wrote: > When a cgroup directory is removed, the memory cgroup subsys state does > not disappear immediately. Instead, it's left hanging around until the > last reference to it is gone, which implies reclaiming all pages from > its lruvec. > > In the unified hierarchy, there's the memory.low knob, which can be used > to set a best-effort protection for a memory cgroup - the reclaimer > first scans those cgroups whose consumption is above memory.low, and > only if it fails to reclaim enough pages, it gets to the rest. > > Currently this protection is not reset when the cgroup directory is > removed. As a result, if a dead memory cgroup has a lot of page cache > charged to it and a high value of memory.low, it will result in higher > pressure exerted on live cgroups, and userspace will have no ways to > detect such consumers and reconfigure memory.low properly. > > To fix this, let's reset memory.low on css offline. Makes sense to me > Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com> Acked-by: Michal Hocko <mhocko@suse.com> > --- > mm/memcontrol.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index ae8b81c55685..ab7bfe870c7d 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -4214,6 +4214,8 @@ static void mem_cgroup_css_offline(struct cgroup_subsys_state *css) > > memcg_offline_kmem(memcg); > wb_memcg_offline(memcg); > + > + memcg->low = 0; > } > > static void mem_cgroup_css_released(struct cgroup_subsys_state *css) > -- > 2.1.4 -- Michal Hocko SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Johannes Weiner <hannes@cmpxchg.org> |
|---|---|
| Date | 2016-02-29 21:10 +0100 |
| Message-ID | <r7CiJ-7H6-1@gated-at.bofh.it> |
| In reply to | #1346008 |
On Mon, Feb 29, 2016 at 08:16:33PM +0300, Vladimir Davydov wrote: > When a cgroup directory is removed, the memory cgroup subsys state does > not disappear immediately. Instead, it's left hanging around until the > last reference to it is gone, which implies reclaiming all pages from > its lruvec. > > In the unified hierarchy, there's the memory.low knob, which can be used > to set a best-effort protection for a memory cgroup - the reclaimer > first scans those cgroups whose consumption is above memory.low, and > only if it fails to reclaim enough pages, it gets to the rest. > > Currently this protection is not reset when the cgroup directory is > removed. As a result, if a dead memory cgroup has a lot of page cache > charged to it and a high value of memory.low, it will result in higher > pressure exerted on live cgroups, and userspace will have no ways to > detect such consumers and reconfigure memory.low properly. > > To fix this, let's reset memory.low on css offline. We already have mem_cgroup_css_reset() for soft-offlining a css - when the css is asked to be disabled but another subsystem still uses it. Can we just call that function during offline as well? The css can be around for quite a bit after the user deleted it. Eliminating *any* user-supplied configurations and zapping it back to defaults makes sense in general, so that we never have to worry about any remnants.
[toc] | [prev] | [next] | [standalone]
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2016-02-29 22:00 +0100 |
| Message-ID | <r7D58-7Z4-5@gated-at.bofh.it> |
| In reply to | #1346132 |
Hello, On Mon, Feb 29, 2016 at 03:02:55PM -0500, Johannes Weiner wrote: > > To fix this, let's reset memory.low on css offline. > > We already have mem_cgroup_css_reset() for soft-offlining a css - when > the css is asked to be disabled but another subsystem still uses it. > Can we just call that function during offline as well? The css can be > around for quite a bit after the user deleted it. Eliminating *any* > user-supplied configurations and zapping it back to defaults makes > sense in general, so that we never have to worry about any remnants. Hmmm... I wonder whether the behavior can be a bit surprising and it could be better to simply let memcg offline callback to call the reset function explicitly. No big deal either way tho. Please feel free to send a patch. Thanks. -- tejun
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web