aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2016-01-14 18:21:32 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-14 19:00:49 -0500
commit8e8ae645249b85c8ed6c178557f8db8613a6bcc7 (patch)
treee1c347c9b18cad1a979dda026a1dff6f310d8977 /mm/memcontrol.c
parentf7e1cb6ec51b041335b5ad4dd7aefb37a56d79a6 (diff)
mm: memcontrol: hook up vmpressure to socket pressure
Let the networking stack know when a memcg is under reclaim pressure so that it can clamp its transmit windows accordingly. Whenever the reclaim efficiency of a cgroup's LRU lists drops low enough for a MEDIUM or HIGH vmpressure event to occur, assert a pressure state in the socket and tcp memory code that tells it to curb consumption growth from sockets associated with said control group. Traditionally, vmpressure reports for the entire subtree of a memcg under pressure, which drops useful information on the individual groups reclaimed. However, it's too late to change the userinterface, so add a second reporting mode that reports on the level of reclaim instead of at the level of pressure, and use that report for sockets. vmpressure events are naturally edge triggered, so for hysteresis assert socket pressure for a second to allow for subsequent vmpressure events to occur before letting the socket code return to normal. This will likely need finetuning for a wider variety of workloads, but for now stick to the vmpressure presets and keep hysteresis simple. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: David S. Miller <davem@davemloft.net> Reviewed-by: Vladimir Davydov <vdavydov@virtuozzo.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 60ebc486c2aa..df7f144a5a4b 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1113,9 +1113,6 @@ bool task_in_mem_cgroup(struct task_struct *task, struct mem_cgroup *memcg)
1113 return ret; 1113 return ret;
1114} 1114}
1115 1115
1116#define mem_cgroup_from_counter(counter, member) \
1117 container_of(counter, struct mem_cgroup, member)
1118
1119/** 1116/**
1120 * mem_cgroup_margin - calculate chargeable space of a memory cgroup 1117 * mem_cgroup_margin - calculate chargeable space of a memory cgroup
1121 * @memcg: the memory cgroup 1118 * @memcg: the memory cgroup
@@ -4183,17 +4180,6 @@ static void __mem_cgroup_free(struct mem_cgroup *memcg)
4183 kfree(memcg); 4180 kfree(memcg);
4184} 4181}
4185 4182
4186/*
4187 * Returns the parent mem_cgroup in memcgroup hierarchy with hierarchy enabled.
4188 */
4189struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg)
4190{
4191 if (!memcg->memory.parent)
4192 return NULL;
4193 return mem_cgroup_from_counter(memcg->memory.parent, memory);
4194}
4195EXPORT_SYMBOL(parent_mem_cgroup);
4196
4197static struct cgroup_subsys_state * __ref 4183static struct cgroup_subsys_state * __ref
4198mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) 4184mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css)
4199{ 4185{
@@ -4234,6 +4220,9 @@ mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css)
4234#ifdef CONFIG_CGROUP_WRITEBACK 4220#ifdef CONFIG_CGROUP_WRITEBACK
4235 INIT_LIST_HEAD(&memcg->cgwb_list); 4221 INIT_LIST_HEAD(&memcg->cgwb_list);
4236#endif 4222#endif
4223#ifdef CONFIG_INET
4224 memcg->socket_pressure = jiffies;
4225#endif
4237 return &memcg->css; 4226 return &memcg->css;
4238 4227
4239free_out: 4228free_out: