Re: [PATCH v4 6/8] tcp buffer limitation: per-cgroup limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/04/2011 05:21 AM, KAMEZAWA Hiroyuki wrote:
On Mon,  3 Oct 2011 14:18:41 +0400
Glauber Costa<glommer@xxxxxxxxxxxxx>  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@xxxxxxxxxxxxx>
CC: David S. Miller<davem@xxxxxxxxxxxxx>
CC: Hiroyouki Kamezawa<kamezawa.hiroyu@xxxxxxxxxxxxxx>
CC: Eric W. Biederman<ebiederm@xxxxxxxxxxxx>
---
  Documentation/cgroups/memory.txt |    1 +
  include/linux/memcontrol.h       |   10 +++++
  include/net/tcp.h                |    1 +
  mm/memcontrol.c                  |   76 +++++++++++++++++++++++++++++++++++---
  net/ipv4/sysctl_net_ipv4.c       |   20 ++++++++++
  5 files changed, 102 insertions(+), 6 deletions(-)

diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
index 6f1954a..1ffde3e 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.max_memory      # set/show hard limit for tcp buf memory


What is the releationship between tcp.max_memory and kmem_limit ?
Quite loose.

tcp.max_memory<  kmem_limit ?
usage of tcp memory is included in kmem usage ?
tcp.max_memory is < kmem_limit, for it to be meaningful. But I don't think we need to force that. I may want to start with a high value for tcp_max_memory and low on kmem_limit, and raise it later.

So here is how it goes:

Memory is allocated from the slab, and then it's usage is independently controlled by the network-specific memory pressure conditions until it
is reclaimed.

Memory allocation can succeed, but then fail to be assigned to the socket due to memory pressure.

Since we more or less agree that on accounting the slab according to Greg's idea, I am not concerning myself with the actual accounting here, since it will come for free when we account the slab.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]