aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memcontrol.h
diff options
context:
space:
mode:
authorGlauber Costa <glommer@parallels.com>2011-12-11 16:47:03 -0500
committerDavid S. Miller <davem@davemloft.net>2011-12-12 19:04:10 -0500
commite1aab161e0135aafcd439be20b4f35e4b0922d95 (patch)
treed0bcdf7a34a34020079238027b431ffc6dece307 /include/linux/memcontrol.h
parent180d8cd942ce336b2c869d324855c40c5db478ad (diff)
socket: initial cgroup code.
The goal of this work is to move the memory pressure tcp controls to a cgroup, instead of just relying on global conditions. To avoid excessive overhead in the network fast paths, the code that accounts allocated memory to a cgroup is hidden inside a static_branch(). This branch is patched out until the first non-root cgroup is created. So when nobody is using cgroups, even if it is mounted, no significant performance penalty should be seen. This patch handles the generic part of the code, and has nothing tcp-specific. Signed-off-by: Glauber Costa <glommer@parallels.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujtsu.com> CC: Kirill A. Shutemov <kirill@shutemov.name> CC: David S. Miller <davem@davemloft.net> CC: Eric W. Biederman <ebiederm@xmission.com> CC: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/memcontrol.h')
-rw-r--r--include/linux/memcontrol.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index b87068a1a09e..f15021b9f734 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -85,6 +85,8 @@ extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
85extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); 85extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
86extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm); 86extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm);
87 87
88extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg);
89
88static inline 90static inline
89int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup) 91int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
90{ 92{
@@ -381,5 +383,25 @@ mem_cgroup_print_bad_page(struct page *page)
381} 383}
382#endif 384#endif
383 385
386#ifdef CONFIG_INET
387enum {
388 UNDER_LIMIT,
389 SOFT_LIMIT,
390 OVER_LIMIT,
391};
392
393struct sock;
394#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
395void sock_update_memcg(struct sock *sk);
396void sock_release_memcg(struct sock *sk);
397#else
398static inline void sock_update_memcg(struct sock *sk)
399{
400}
401static inline void sock_release_memcg(struct sock *sk)
402{
403}
404#endif /* CONFIG_CGROUP_MEM_RES_CTLR_KMEM */
405#endif /* CONFIG_INET */
384#endif /* _LINUX_MEMCONTROL_H */ 406#endif /* _LINUX_MEMCONTROL_H */
385 407