OpenVZ Forum - RDF feed
type: channel
items: [PATCH v6 0/8] per-cgroup tcp memory pressure handling
items: [PATCH v6 1/8] Basic kernel memory functionality for the Memory Controller
items: [PATCH v6 2/8] socket: initial cgroup code.
items: [PATCH v6 3/8] foundations of per-cgroup memory pressure controlling.
items: [PATCH v6 4/8] per-cgroup tcp buffers control
items: [PATCH v6 5/8] per-netns ipv4 sysctl_tcp_mem
items: [PATCH v6 6/8] tcp buffer limitation: per-cgroup limit
items: [PATCH v6 7/8] Display current tcp memory allocation in kmem cgroup
items: [PATCH v6 8/8] Disable task moving when using kernel memory accounting
items: Re: [PATCH v6 1/8] Basic kernel memory functionality for the Memory Controller
items: Re: [PATCH v6 3/8] foundations of per-cgroup memory pressure controlling.
items: Re: [PATCH v6 4/8] per-cgroup tcp buffers control
items: Re: [PATCH v6 6/8] tcp buffer limitation: per-cgroup limit
items: Re: [PATCH v6 7/8] Display current tcp memory allocation in kmem cgroup
items: Re: [PATCH v6 8/8] Disable task moving when using kernel memory accounting

[PATCH v6 0/8] per-cgroup tcp memory pressure handling
type: item
description: Hi Guys, I hope we have it all sorted this time. Main differences from v5: * using res_counters for tcp_memory_allocated * tried to get maximum consistency with the rest of memcg files Now files appear even in root memcg, but we can't set any limits on it. (comes more or less for free with re-use of the files) * softlimit and failcnt are not shown, but I intend to introduce them in a followup series (failcnt is easy, but softlimit may need some more network-side work, at least testing) I will be happy to address any comments you may have. Glauber Costa (8): Basic kernel memory functionality for the Memory Controller socket: initial cgroup code. foundations of per-cgroup memory pressure controlling. per-cgroup tcp buffers control per-netns ipv4 sysctl_tcp_mem tcp buffer limitation: per-cgroup limit Display current tcp memory allocation in kmem cgroup Disable task moving when using kernel memory accounting Documentation/cgroups/memory.txt | 38 ++++- crypto/af_alg.c | 8 +- include/linux/memcontrol.h | 49 +++++ include/net/netns/ipv4.h | 1 + include/net/sock.h | 130 +++++++++++++- include/net/tcp.h | 30 +++- include/net/udp.h | 4 +- include/trace/events/sock.h | 10 +- init/Kconfig | 14 ++ mm/memcontrol.c | 375 ++++++++++++++++++++++++++++++++++++-- net/core/sock.c | 104 ++++++++--- net/decnet/af_decnet.c | 22 ++- net/ipv4/proc.c | 7 +- net/ipv4/sysctl_net_ipv4.c | 71 +++++++- net/ipv4/tcp.c | 60 ++++--- net/ipv4/tcp_input.c | 12 +- net/ipv4/tcp_ipv4.c | 23 ++- net/ipv4/tcp_output.c | 2 +- net/ipv4/tcp_timer.c | 2 +- net/ipv4/udp.c | 21 ++- net/ipv6/tcp_ipv6.c | 20 ++- net/ipv6/udp.c | 4 +- net/sctp/socket.c | 37 +++- 23 files changed, 912 insertions(+), 132 deletions(-) -- 1.7.6.4
creator: Glauber Costa
date: 2011-10-10T10:24:20-00:00

[PATCH v6 1/8] Basic kernel memory functionality for the Memory Controller
type: item
description: This patch lays down the foundation for the kernel memory component of the Memory Controller. As of today, I am only laying down the following files: * memory.independent_kmem_limit * memory.kmem.limit_in_bytes (currently ignored) * memory.kmem.usage_in_bytes (always zero) Signed-off-by: Glauber Costa <glommer@parallels.com> Reviewed-by: Kirill A. Shutemov <kirill@shutemov.name> CC: Paul Menage <paul@paulmenage.org> CC: Greg Thelen <gthelen@google.com> --- Documentation/cgroups/memory.txt | 36 ++++++++++++++- init/Kconfig | 14 ++++++ mm/memcontrol.c | 91 +++++++++++++++++++++++++++++++++++-- 3 files changed, 134 insertions(+), 7 deletions(-) diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index 06eb6d9..bf00cd2 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt @@ -44,8 +44,9 @@ Features: - oom-killer disable knob and oom-notifier - Root cgroup has no limit controls. - Kernel memory and Hugepages are not under control yet. We just manage - pages on LRU. To add more controls, we have to take care of performance. + Hugepages is not under control yet. We just manage pages on LRU. To add more + controls, we have to take care of performance. Kernel memory support is work + in progress, and the current version provides basically functionality. Brief summary of control files. @@ -56,8 +57,11 @@ Brief summary of control files. (See 5.5 for details) memory.memsw.usage_in_bytes # show current res_counter usage for memory+Swap (See 5.5 for details) + memory.kmem.usage_in_bytes # show current res_counter usage for kmem only. + (See 2.7 for details) memory.limit_in_bytes # set/show limit of memory usage memory.memsw.limit_in_bytes # set/show limit of memory+Swap usage + memory.kmem.limit_in_bytes # if allowed, set/show limit of kernel memory memory.failcnt # show the number of memory usage hits limits memory.memsw.failcnt # show the number of memory+Swap hits limits memory.max_usage_in_bytes # show max memory usa…
creator: Glauber Costa
date: 2011-10-10T10:24:21-00:00

[PATCH v6 2/8] socket: initial cgroup code.
type: item
description: We aim to control the amount of kernel memory pinned at any time by tcp sockets. To lay the foundations for this work, this patch adds a pointer to the kmem_cgroup to the socket structure. Signed-off-by: Glauber Costa <glommer@parallels.com> Acked-by: Kirill A. Shutemov<kirill@shutemov.name> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujtsu.com> CC: David S. Miller <davem@davemloft.net> CC: Eric W. Biederman <ebiederm@xmission.com> --- include/linux/memcontrol.h | 15 +++++++++++++++ include/net/sock.h | 2 ++ mm/memcontrol.c | 37 +++++++++++++++++++++++++++++++++++++ net/core/sock.c | 3 +++ 4 files changed, 57 insertions(+), 0 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 343bd76..88aea1b 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -376,5 +376,20 @@ mem_cgroup_print_bad_page(struct page *page) } #endif +#ifdef CONFIG_INET +struct sock; +#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM +void sock_update_memcg(struct sock *sk); +void sock_release_memcg(struct sock *sk); + +#else +static inline void sock_update_memcg(struct sock *sk) +{ +} +static inline void sock_release_memcg(struct sock *sk) +{ +} +#endif /* CONFIG_CGROUP_MEM_RES_CTLR_KMEM */ +#endif /* CONFIG_INET */ #endif /* _LINUX_MEMCONTROL_H */ diff --git a/include/net/sock.h b/include/net/sock.h index 8e4062f..afe1467 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -228,6 +228,7 @@ struct sock_common { * @sk_security: used by security modules * @sk_mark: generic packet mark * @sk_classid: this socket's cgroup classid + * @sk_cgrp: this socket's kernel memory (kmem) cgroup * @sk_write_pending: a write to stream socket waits to start * @sk_state_change: callback to indicate change in the state of the sock * @sk_data_ready: callback to indicate there is data to be processed @@ -339,6 +340,7 @@ struct sock { #endif __u32 sk_mark; u32 sk_classid; + struct mem_cgroup *sk_cgrp; void (*sk_state_change)(struct sock *sk); void (*sk_data_…
creator: Glauber Costa
date: 2011-10-10T10:24:22-00:00

[PATCH v6 3/8] foundations of per-cgroup memory pressure controlling.
type: item
description: This patch converts struct sock fields memory_pressure, memory_allocated, sockets_allocated, and sysctl_mem (now prot_mem) to function pointers, receiving a struct mem_cgroup parameter. enter_memory_pressure is kept the same, since all its callers have socket a context, and the kmem_cgroup can be derived from the socket itself. To keep things working, the patch convert all users of those fields to use acessor functions. In my benchmarks I didn't see a significant performance difference with this patch applied compared to a baseline (around 1 % diff, thus inside error margin). Signed-off-by: Glauber Costa <glommer@parallels.com> CC: David S. Miller <davem@davemloft.net> CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com> CC: Eric W. Biederman <ebiederm@xmission.com> --- crypto/af_alg.c | 8 +++- include/linux/memcontrol.h | 22 ++++++++- include/net/sock.h | 114 ++++++++++++++++++++++++++++++++++++++++-- include/net/tcp.h | 12 +++-- include/net/udp.h | 4 +- include/trace/events/sock.h | 10 ++-- mm/memcontrol.c | 19 ++++++- net/core/sock.c | 62 ++++++++++++++--------- net/decnet/af_decnet.c | 22 +++++++- net/ipv4/proc.c | 7 ++- net/ipv4/tcp.c | 28 +++++++++- net/ipv4/tcp_input.c | 12 ++-- net/ipv4/tcp_ipv4.c | 12 ++-- net/ipv4/tcp_output.c | 2 +- net/ipv4/tcp_timer.c | 2 +- net/ipv4/udp.c | 21 ++++++-- net/ipv6/tcp_ipv6.c | 10 ++-- net/ipv6/udp.c | 4 +- net/sctp/socket.c | 37 +++++++++++--- 19 files changed, 320 insertions(+), 88 deletions(-) diff --git a/crypto/af_alg.c b/crypto/af_alg.c index ac33d5f..09cdf11 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -29,10 +29,16 @@ struct alg_type_list { static atomic_long_t alg_memory_allocated; +static long memory_allocated_alg(struct mem_cgroup *memcg, long val, + int *parent_status) +{ + return atomic_long_add_return(val, &alg_memory_allocated); +} + static struct proto alg_proto = { .name = "ALG", .owner = THIS_MODULE, - .memory_allocated = &alg_memory_allocated, + .mem_allocated_add = memory_allocated_alg, .obj…
creator: Glauber Costa
date: 2011-10-10T10:24:23-00:00

[PATCH v6 4/8] per-cgroup tcp buffers control
type: item
description: With all the infrastructure in place, this patch implements per-cgroup control for tcp memory pressure handling. Signed-off-by: Glauber Costa <glommer@parallels.com> CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujtisu.com> CC: David S. Miller <davem@davemloft.net> CC: Eric W. Biederman <ebiederm@xmission.com> --- include/linux/memcontrol.h | 4 + include/net/sock.h | 14 ++++ include/net/tcp.h | 17 +++++ mm/memcontrol.c | 141 ++++++++++++++++++++++++++++++++++++++++++++ net/core/sock.c | 39 +++++++++++- net/ipv4/tcp.c | 47 +++++++-------- net/ipv4/tcp_ipv4.c | 11 ++++ net/ipv6/tcp_ipv6.c | 10 +++- 8 files changed, 255 insertions(+), 28 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 99a8ba2..a27dad9 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -393,6 +393,10 @@ void sock_update_memcg(struct sock *sk); void sock_release_memcg(struct sock *sk); void memcg_sockets_allocated_dec(struct mem_cgroup *memcg, struct proto *prot); void memcg_sockets_allocated_inc(struct mem_cgroup *memcg, struct proto *prot); +int tcp_init_cgroup(const struct proto *prot, struct cgroup *cgrp, + struct cgroup_subsys *ss); +void tcp_destroy_cgroup(const struct proto *prot, struct cgroup *cgrp, + struct cgroup_subsys *ss); #else /* memcontrol includes sockets.h, that includes memcontrol.h ... */ static inline void memcg_sockets_allocated_dec(struct mem_cgroup *memcg, diff --git a/include/net/sock.h b/include/net/sock.h index 163f87b..efd7664 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -64,6 +64,8 @@ #include <net/dst.h> #include <net/checksum.h> +int sockets_populate(struct cgroup *cgrp, struct cgroup_subsys *ss); +void sockets_destroy(struct cgroup *cgrp, struct cgroup_subsys *ss); /* * This structure really needs to be cleaned up. * Most of it is for TCP, and not used by any of @@ -819,6 +821,18 @@ struct proto { /* Pointer to the per-cgroup version of the the sysctl_mem field */ long *(*prot_mem)(const struct m…
creator: Glauber Costa
date: 2011-10-10T10:24:24-00:00

[PATCH v6 5/8] per-netns ipv4 sysctl_tcp_mem
type: item
description: This patch allows each namespace to independently set up its levels for tcp memory pressure thresholds. This patch alone does not buy much: we need to make this values per group of process somehow. This is achieved in the patches that follows in this patchset. Signed-off-by: Glauber Costa <glommer@parallels.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> CC: David S. Miller <davem@davemloft.net> CC: Eric W. Biederman <ebiederm@xmission.com> --- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 1 - mm/memcontrol.c | 8 ++++-- net/ipv4/sysctl_net_ipv4.c | 51 +++++++++++++++++++++++++++++++++++++------ net/ipv4/tcp.c | 13 ++-------- 5 files changed, 53 insertions(+), 21 deletions(-) diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index d786b4f..bbd023a 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -55,6 +55,7 @@ struct netns_ipv4 { int current_rt_cache_rebuild_count; unsigned int sysctl_ping_group_range[2]; + long sysctl_tcp_mem[3]; atomic_t rt_genid; atomic_t dev_addr_genid; diff --git a/include/net/tcp.h b/include/net/tcp.h index ec57cf2..3609d87 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -232,7 +232,6 @@ extern int sysctl_tcp_fack; extern int sysctl_tcp_reordering; extern int sysctl_tcp_ecn; extern int sysctl_tcp_dsack; -extern long sysctl_tcp_mem[3]; extern int sysctl_tcp_wmem[3]; extern int sysctl_tcp_rmem[3]; extern int sysctl_tcp_app_win; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index efff83b..651badb 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -390,6 +390,7 @@ static struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont); #ifdef CONFIG_INET #include <net/sock.h> #include <net/ip.h> +#include <linux/nsproxy.h> void sock_update_memcg(struct sock *sk) { @@ -526,14 +527,15 @@ int tcp_init_cgroup(const struct proto *prot, struct cgroup *cgrp, struct cgroup_subsys *ss) { struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); + struct net *net = current->nsproxy->net_n…
creator: Glauber Costa
date: 2011-10-10T10:24:25-00:00

[PATCH v6 6/8] tcp buffer limitation: per-cgroup limit
type: item
description: This patch uses the "tcp_max_mem" field of the kmem_cgroup to effectively control the amount of kernel memory pinned by a cgroup. We have to make sure that none of the memory pressure thresholds specified in the namespace are bigger than the current cgroup. Signed-off-by: Glauber Costa <glommer@parallels.com> CC: David S. Miller <davem@davemloft.net> CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com> CC: Eric W. Biederman <ebiederm@xmission.com> --- Documentation/cgroups/memory.txt | 1 + include/linux/memcontrol.h | 10 +++++ mm/memcontrol.c | 79 ++++++++++++++++++++++++++++++++++---- net/ipv4/sysctl_net_ipv4.c | 20 ++++++++++ 4 files changed, 102 insertions(+), 8 deletions(-) diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index bf00cd2..c1db134 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt @@ -78,6 +78,7 @@ Brief summary of control files. memory.independent_kmem_limit # select whether or not kernel memory limits are independent of user limits + memory.kmem.tcp.limit_in_bytes # set/show hard limit for tcp buf memory 1. History diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index a27dad9..e0ccec5 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -397,6 +397,9 @@ int tcp_init_cgroup(const struct proto *prot, struct cgroup *cgrp, struct cgroup_subsys *ss); void tcp_destroy_cgroup(const struct proto *prot, struct cgroup *cgrp, struct cgroup_subsys *ss); + +unsigned long long tcp_max_memory(const struct mem_cgroup *memcg); +void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx); #else /* memcontrol includes sockets.h, that includes memcontrol.h ... */ static inline void memcg_sockets_allocated_dec(struct mem_cgroup *memcg, @@ -413,6 +416,13 @@ static inline void sock_update_memcg(struct sock *sk) static inline void sock_release_memcg(struct sock *sk) { } +static inline unsigned long long tcp_max_memory(const struct mem_cgroup *memcg) +{ + r…
creator: Glauber Costa
date: 2011-10-10T10:24:26-00:00

[PATCH v6 7/8] Display current tcp memory allocation in kmem cgroup
type: item
description: This patch introduces kmem.tcp_current_memory file, living in the kmem_cgroup filesystem. It is a simple read-only file that displays the amount of kernel memory currently consumed by the cgroup. Signed-off-by: Glauber Costa <glommer@parallels.com> CC: David S. Miller <davem@davemloft.net> CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com> CC: Eric W. Biederman <ebiederm@xmission.com> --- Documentation/cgroups/memory.txt | 1 + mm/memcontrol.c | 5 +++++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index c1db134..00f1a88 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt @@ -79,6 +79,7 @@ Brief summary of control files. memory.independent_kmem_limit # select whether or not kernel memory limits are independent of user limits memory.kmem.tcp.limit_in_bytes # set/show hard limit for tcp buf memory + memory.kmem.tcp.usage_in_bytes # show current tcp buf memory allocation 1. History diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 60e0ec0..ca08be2 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -543,6 +543,11 @@ static struct cftype tcp_files[] = { .read_u64 = mem_cgroup_read, .private = MEMFILE_PRIVATE(_KMEM_TCP, RES_LIMIT), }, + { + .name = "kmem.tcp.usage_in_bytes", + .read_u64 = mem_cgroup_read, + .private = MEMFILE_PRIVATE(_KMEM_TCP, RES_USAGE), + }, }; static void tcp_create_cgroup(struct mem_cgroup *cg, struct cgroup_subsys *ss) -- 1.7.6.4
creator: Glauber Costa
date: 2011-10-10T10:24:27-00:00

[PATCH v6 8/8] Disable task moving when using kernel memory accounting
type: item
description: Since this code is still experimental, we are leaving the exact details of how to move tasks between cgroups when kernel memory accounting is used as future work. For now, we simply disallow movement if there are any pending accounted memory. Signed-off-by: Glauber Costa <glommer@parallels.com> CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com> --- mm/memcontrol.c | 31 ++++++++++++++++++------------- 1 files changed, 18 insertions(+), 13 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index ca08be2..8d1beeb 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -408,23 +408,11 @@ void sock_update_memcg(struct sock *sk) rcu_read_lock(); sk->sk_cgrp = mem_cgroup_from_task(current); - - /* - * We don't need to protect against anything task-related, because - * we are basically stuck with the sock pointer that won't change, - * even if the task that originated the socket changes cgroups. - * - * What we do have to guarantee, is that the chain leading us to - * the top level won't change under our noses. Incrementing the - * reference count via cgroup_exclude_rmdir guarantees that. - */ - cgroup_exclude_rmdir(mem_cgroup_css(sk->sk_cgrp)); rcu_read_unlock(); } void sock_release_memcg(struct sock *sk) { - cgroup_release_and_wakeup_rmdir(mem_cgroup_css(sk->sk_cgrp)); } void memcg_sockets_allocated_dec(struct mem_cgroup *memcg, struct proto *prot) @@ -5636,10 +5624,17 @@ static int mem_cgroup_can_attach(struct cgroup_subsys *ss, { int ret = 0; struct mem_cgroup *mem = mem_cgroup_from_cont(cgroup); + struct mem_cgroup *from = mem_cgroup_from_task(p); + + if (from != mem && + res_counter_read_u64(&mem->tcp.tcp_memory_allocated, RES_USAGE)) { + printk(KERN_WARNING "Can't move tasks between cgroups: " + "Kernel memory held. task: %s\n", p->comm); + return 1; + } if (mem->move_charge_at_immigrate) { struct mm_struct *mm; - struct mem_cgroup *from = mem_cgroup_from_task(p); VM_BUG_ON(from == mem); @@ -5807,6 +5802,16 @@ static int mem_cgroup_can_attach(struct cgrou…
creator: Glauber Costa
date: 2011-10-10T10:24:28-00:00

Re: [PATCH v6 1/8] Basic kernel memory functionality for the Memory Controller
type: item
description: On Mon, 10 Oct 2011 14:24:21 +0400 Glauber Costa <glommer@parallels.com> wrote: > This patch lays down the foundation for the kernel memory component > of the Memory Controller. > > As of today, I am only laying down the following files: > > * memory.independent_kmem_limit > * memory.kmem.limit_in_bytes (currently ignored) > * memory.kmem.usage_in_bytes (always zero) > > Signed-off-by: Glauber Costa <glommer@parallels.com> > Reviewed-by: Kirill A. Shutemov <kirill@shutemov.name> > CC: Paul Menage <paul@paulmenage.org> > CC: Greg Thelen <gthelen@google.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
creator: KAMEZAWA Hiroyuki
date: 2011-10-13T05:44:30-00:00

Re: [PATCH v6 3/8] foundations of per-cgroup memory pressure controlling.
type: item
description: On Mon, 10 Oct 2011 14:24:23 +0400 Glauber Costa <glommer@parallels.com> wrote: > This patch converts struct sock fields memory_pressure, > memory_allocated, sockets_allocated, and sysctl_mem (now prot_mem) > to function pointers, receiving a struct mem_cgroup parameter. > > enter_memory_pressure is kept the same, since all its callers > have socket a context, and the kmem_cgroup can be derived from > the socket itself. > > To keep things working, the patch convert all users of those fields > to use acessor functions. > > In my benchmarks I didn't see a significant performance difference > with this patch applied compared to a baseline (around 1 % diff, thus > inside error margin). > > Signed-off-by: Glauber Costa <glommer@parallels.com> > CC: David S. Miller <davem@davemloft.net> > CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com> > CC: Eric W. Biederman <ebiederm@xmission.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> a nitpick. > #ifdef CONFIG_INET > +enum { > + UNDER_LIMIT, > + OVER_LIMIT, > +}; > + It may be better to move this to res_counter.h or memcontrol.h
creator: KAMEZAWA Hiroyuki
date: 2011-10-13T05:53:53-00:00

Re: [PATCH v6 4/8] per-cgroup tcp buffers control
type: item
description: On Mon, 10 Oct 2011 14:24:24 +0400 Glauber Costa <glommer@parallels.com> wrote: > With all the infrastructure in place, this patch implements > per-cgroup control for tcp memory pressure handling. > > Signed-off-by: Glauber Costa <glommer@parallels.com> > CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujtisu.com> > CC: David S. Miller <davem@davemloft.net> > CC: Eric W. Biederman <ebiederm@xmission.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
creator: KAMEZAWA Hiroyuki
date: 2011-10-13T05:56:52-00:00

Re: [PATCH v6 6/8] tcp buffer limitation: per-cgroup limit
type: item
description: On Mon, 10 Oct 2011 14:24:26 +0400 Glauber Costa <glommer@parallels.com> wrote: > This patch uses the "tcp_max_mem" field of the kmem_cgroup to > effectively control the amount of kernel memory pinned by a cgroup. > > We have to make sure that none of the memory pressure thresholds > specified in the namespace are bigger than the current cgroup. > > Signed-off-by: Glauber Costa <glommer@parallels.com> > CC: David S. Miller <davem@davemloft.net> > CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com> > CC: Eric W. Biederman <ebiederm@xmission.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
creator: KAMEZAWA Hiroyuki
date: 2011-10-13T05:58:51-00:00

Re: [PATCH v6 7/8] Display current tcp memory allocation in kmem cgroup
type: item
description: On Mon, 10 Oct 2011 14:24:27 +0400 Glauber Costa <glommer@parallels.com> wrote: > This patch introduces kmem.tcp_current_memory file, living in the > kmem_cgroup filesystem. It is a simple read-only file that displays the > amount of kernel memory currently consumed by the cgroup. > > Signed-off-by: Glauber Costa <glommer@parallels.com> > CC: David S. Miller <davem@davemloft.net> > CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com> > CC: Eric W. Biederman <ebiederm@xmission.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
creator: KAMEZAWA Hiroyuki
date: 2011-10-13T05:59:31-00:00

Re: [PATCH v6 8/8] Disable task moving when using kernel memory accounting
type: item
description: On Mon, 10 Oct 2011 14:24:28 +0400 Glauber Costa <glommer@parallels.com> wrote: > Since this code is still experimental, we are leaving the exact > details of how to move tasks between cgroups when kernel memory > accounting is used as future work. > > For now, we simply disallow movement if there are any pending > accounted memory. > > Signed-off-by: Glauber Costa <glommer@parallels.com> > CC: Hiroyouki Kamezawa <kamezawa.hiroyu@jp.fujitsu.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
creator: KAMEZAWA Hiroyuki
date: 2011-10-13T06:00:21-00:00

Re: [PATCH v6 1/8] Basic kernel memory functionality for the Memory Controller
type: item
description: On Mon, Oct 10, 2011 at 3:24 AM, Glauber Costa <glommer@parallels.com> wrote: > diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt > index 06eb6d9..bf00cd2 100644 > --- a/Documentation/cgroups/memory.txt > +++ b/Documentation/cgroups/memory.txt ... > @@ -255,6 +262,31 @@ When oom event notifier is registered, event will be delivered. > per-zone-per-cgroup LRU (cgroup's private LRU) is just guarded by > zone->lru_lock, it has no lock of its own. > > +2.7 Kernel Memory Extension (CONFIG_CGROUP_MEM_RES_CTLR_KMEM) > + > + With the Kernel memory extension, the Memory Controller is able to limit Extra leading space before 'With'. > +the amount of kernel memory used by the system. Kernel memory is fundamentally > +different than user memory, since it can't be swapped out, which makes it > +possible to DoS the system by consuming too much of this precious resource. > +Kernel memory limits are not imposed for the root cgroup. > + > +Memory limits as specified by the standard Memory Controller may or may not > +take kernel memory into consideration. This is achieved through the file > +memory.independent_kmem_limit. A Value different than 0 will allow for kernel s/Value/value/ > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 3508777..d25c5cb 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c ... > +static int kmem_limit_independent_write(struct cgroup *cont, struct cftype *cft, > + u64 val) > +{ > + cgroup_lock(); > + mem_cgroup_from_cont(cont)->kmem_independent_accounting = !!val; > + cgroup_unlock(); I do not think cgroup_lock,unlock are needed here. The cont and associated cgroup should be guaranteed by the caller to be valid. Does this lock provide some other synchronization?
creator: Greg Thelen
date: 2011-10-13T07:18:49-00:00

Re: [PATCH v6 1/8] Basic kernel memory functionality for the Memory Controller
type: item
description: On 10/13/2011 11:18 AM, Greg Thelen wrote: > On Mon, Oct 10, 2011 at 3:24 AM, Glauber Costa<glommer@parallels.com> wrote: >> diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt >> index 06eb6d9..bf00cd2 100644 >> --- a/Documentation/cgroups/memory.txt >> +++ b/Documentation/cgroups/memory.txt > ... >> @@ -255,6 +262,31 @@ When oom event notifier is registered, event will be delivered. >> per-zone-per-cgroup LRU (cgroup's private LRU) is just guarded by >> zone->lru_lock, it has no lock of its own. >> >> +2.7 Kernel Memory Extension (CONFIG_CGROUP_MEM_RES_CTLR_KMEM) >> + >> + With the Kernel memory extension, the Memory Controller is able to limit > > Extra leading space before 'With'. > >> +the amount of kernel memory used by the system. Kernel memory is fundamentally >> +different than user memory, since it can't be swapped out, which makes it >> +possible to DoS the system by consuming too much of this precious resource. >> +Kernel memory limits are not imposed for the root cgroup. >> + >> +Memory limits as specified by the standard Memory Controller may or may not >> +take kernel memory into consideration. This is achieved through the file >> +memory.independent_kmem_limit. A Value different than 0 will allow for kernel > > s/Value/value/ > >> diff --git a/mm/memcontrol.c b/mm/memcontrol.c >> index 3508777..d25c5cb 100644 >> --- a/mm/memcontrol.c >> +++ b/mm/memcontrol.c > ... >> +static int kmem_limit_independent_write(struct cgroup *cont, struct cftype *cft, >> + u64 val) >> +{ >> + cgroup_lock(); >> + mem_cgroup_from_cont(cont)->kmem_independent_accounting = !!val; >> + cgroup_unlock(); > > I do not think cgroup_lock,unlock are needed here. The cont and > associated cgroup should be guaranteed by the caller to be valid. > Does this lock provide some other synchronization? Yeah, I think I was being overcautious. With the following comments addressed, can I add your Reviewed-by to this one ?
creator: Glauber Costa
date: 2011-10-13T08:19:37-00:00

Re: [PATCH v6 3/8] foundations of per-cgroup memory pressure controlling.
type: item
description: On 10/13/2011 09:53 AM, KAMEZAWA Hiroyuki wrote: > On Mon, 10 Oct 2011 14:24:23 +0400 > Glauber Costa<glommer@parallels.com> wrote: > >> This patch converts struct sock fields memory_pressure, >> memory_allocated, sockets_allocated, and sysctl_mem (now prot_mem) >> to function pointers, receiving a struct mem_cgroup parameter. >> >> enter_memory_pressure is kept the same, since all its callers >> have socket a context, and the kmem_cgroup can be derived from >> the socket itself. >> >> To keep things working, the patch convert all users of those fields >> to use acessor functions. >> >> In my benchmarks I didn't see a significant performance difference >> with this patch applied compared to a baseline (around 1 % diff, thus >> inside error margin). >> >> Signed-off-by: Glauber Costa<glommer@parallels.com> >> CC: David S. Miller<davem@davemloft.net> >> CC: Hiroyouki Kamezawa<kamezawa.hiroyu@jp.fujitsu.com> >> CC: Eric W. Biederman<ebiederm@xmission.com> > > Reviewed-by: KAMEZAWA Hiroyuki<kamezawa.hiroyu@jp.fujitsu.com> > > a nitpick. > > >> #ifdef CONFIG_INET >> +enum { >> + UNDER_LIMIT, >> + OVER_LIMIT, >> +}; >> + > > It may be better to move this to res_counter.h or memcontrol.h > Sorry Kame, It is in memcontrol.h already. What exactly do you mean here ?
creator: Glauber Costa
date: 2011-10-13T08:25:53-00:00