From: Glauber Costa <glommer@parallels.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Huang Qiang <h.huangqiang@huawei.com>,
David Miller <davem@davemloft.net>, <netdev@vger.kernel.org>,
<containers@lists.linux-foundation.org>,
<yangzhenzhang@huawei.com>
Subject: Re: [PATCH net-next] netns: correctly use per-netns ipv4 sysctl_tcp_mem
Date: Wed, 25 Jul 2012 16:45:37 +0400 [thread overview]
Message-ID: <500FEA71.9080005@parallels.com> (raw)
In-Reply-To: <1342677832.2626.3839.camel@edumazet-glaptop>
Hi,
On 07/19/2012 10:03 AM, Eric Dumazet wrote:
> On Thu, 2012-07-19 at 13:38 +0800, Huang Qiang wrote:
>> From: Yang Zhenzhang <yangzhenzhang@huawei.com>
>>
>> Now, kernel allows each net namespace to independently set up its levels
>> for tcp memory pressure thresholds.
Not really.
So the real limitation here, is done by the memory controller in cgroup,
not the proc files. AFAIK, lxc does not (yet) touches that file by
default, but it does create a memcg placeholder for you container, where
you can set that yourself.
cgroups are outside the realm of the admin, however. So once the
limitation is in place, you might want to restrain their further,
and that's the role of the files in /proc.
The goal is to have something that is as close as possible to a real
system in a container, where an admin could freely set this. (but of
course, never going over its allowance)
You can note this by what reads in sysctl_ipv4.c, when that file is
written to:
#ifdef CONFIG_MEMCG_KMEM
rcu_read_lock();
memcg = mem_cgroup_from_task(current);
tcp_prot_mem(memcg, vec[0], 0);
tcp_prot_mem(memcg, vec[1], 1);
tcp_prot_mem(memcg, vec[2], 2);
rcu_read_unlock();
#endif
This function is defined in tcp_memcontrol.c
void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx)
{
struct tcp_memcontrol *tcp;
struct cg_proto *cg_proto;
cg_proto = tcp_prot.proto_cgroup(memcg);
if (!cg_proto)
return;
tcp = tcp_from_cgproto(cg_proto);
tcp->tcp_prot_mem[idx] = val;
}
tcp_prot_mem[] ends up being the vector you access as:
prot = sk->sk_cgrp->sysctl_mem;
in the function you patch.
I hope it helps.
prev parent reply other threads:[~2012-07-25 12:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-19 5:38 [PATCH net-next] netns: correctly use per-netns ipv4 sysctl_tcp_mem Huang Qiang
[not found] ` <50079D47.6040001-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2012-07-19 6:03 ` Eric Dumazet
2012-07-25 12:45 ` Glauber Costa [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=500FEA71.9080005@parallels.com \
--to=glommer@parallels.com \
--cc=containers@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=h.huangqiang@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=yangzhenzhang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox