aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memcontrol.h
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2016-01-14 18:21:29 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-14 19:00:49 -0500
commitf7e1cb6ec51b041335b5ad4dd7aefb37a56d79a6 (patch)
treee99135a85ed74987871cf8608287321735249305 /include/linux/memcontrol.h
parent1109208766d9fa7059a9b66ad488e66d99ce49af (diff)
mm: memcontrol: account socket memory in unified hierarchy memory controller
Socket memory can be a significant share of overall memory consumed by common workloads. In order to provide reasonable resource isolation in the unified hierarchy, this type of memory needs to be included in the tracking/accounting of a cgroup under active memory resource control. Overhead is only incurred when a non-root control group is created AND the memory controller is instructed to track and account the memory footprint of that group. cgroup.memory=nosocket can be specified on the boot commandline to override any runtime configuration and forcibly exclude socket memory from active memory resource control. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: David S. Miller <davem@davemloft.net> Reviewed-by: Vladimir Davydov <vdavydov@virtuozzo.com> Acked-by: Michal Hocko <mhocko@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/memcontrol.h')
-rw-r--r--include/linux/memcontrol.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 03090e8e7fff..a355f61a2ed3 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -170,6 +170,9 @@ struct mem_cgroup {
170 unsigned long low; 170 unsigned long low;
171 unsigned long high; 171 unsigned long high;
172 172
173 /* Range enforcement for interrupt charges */
174 struct work_struct high_work;
175
173 unsigned long soft_limit; 176 unsigned long soft_limit;
174 177
175 /* vmpressure notifications */ 178 /* vmpressure notifications */
@@ -680,12 +683,16 @@ void sock_update_memcg(struct sock *sk);
680void sock_release_memcg(struct sock *sk); 683void sock_release_memcg(struct sock *sk);
681bool mem_cgroup_charge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages); 684bool mem_cgroup_charge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages);
682void mem_cgroup_uncharge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages); 685void mem_cgroup_uncharge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages);
683#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_INET) 686#if defined(CONFIG_MEMCG) && defined(CONFIG_INET)
684extern struct static_key memcg_sockets_enabled_key; 687extern struct static_key memcg_sockets_enabled_key;
685#define mem_cgroup_sockets_enabled static_key_false(&memcg_sockets_enabled_key) 688#define mem_cgroup_sockets_enabled static_key_false(&memcg_sockets_enabled_key)
686static inline bool mem_cgroup_under_socket_pressure(struct mem_cgroup *memcg) 689static inline bool mem_cgroup_under_socket_pressure(struct mem_cgroup *memcg)
687{ 690{
691#ifdef CONFIG_MEMCG_KMEM
688 return memcg->tcp_mem.memory_pressure; 692 return memcg->tcp_mem.memory_pressure;
693#else
694 return false;
695#endif
689} 696}
690#else 697#else
691#define mem_cgroup_sockets_enabled 0 698#define mem_cgroup_sockets_enabled 0