From: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public•gmane.org>
To: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public•gmane.org>
Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public•gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public•gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public•gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
Michal Hocko <mhocko-AlSwsSmVLrQ@public•gmane.org>,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public•gmane.org>,
Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public•gmane.org>,
Laurent Chavey <chavey-hpIqsD4AKlfQT0dZR+AlfA@public•gmane.org>
Subject: Re: [PATCH 3/3] net: introduce res_counter_charge_nofail() for socket allocations
Date: Tue, 24 Jan 2012 09:15:52 +0100 [thread overview]
Message-ID: <20120124081552.GB1660@cmpxchg.org> (raw)
In-Reply-To: <1327071436-20763-4-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
On Fri, Jan 20, 2012 at 06:57:16PM +0400, Glauber Costa wrote:
> There is a case in __sk_mem_schedule(), where an allocation
> is beyond the maximum, but yet we are allowed to proceed.
> It happens under the following condition:
>
> sk->sk_wmem_queued + size >= sk->sk_sndbuf
>
> The network code won't revert the allocation in this case,
> meaning that at some point later it'll try to do it. Since
> this is never communicated to the underlying res_counter
> code, there is an inbalance in res_counter uncharge operation.
>
> I see two ways of fixing this:
>
> 1) storing the information about those allocations somewhere
> in memcg, and then deducting from that first, before
> we start draining the res_counter,
> 2) providing a slightly different allocation function for
> the res_counter, that matches the original behavior of
> the network code more closely.
>
> I decided to go for #2 here, believing it to be more elegant,
> since #1 would require us to do basically that, but in a more
> obscure way.
>
> Signed-off-by: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public•gmane.org>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public•gmane.org>
> Cc: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public•gmane.org>
> Cc: Michal Hocko <mhocko-AlSwsSmVLrQ@public•gmane.org>
> CC: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public•gmane.org>
> CC: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public•gmane.org>
> CC: Laurent Chavey <chavey-hpIqsD4AKlfQT0dZR+AlfA@public•gmane.org>
Acked-by: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public•gmane.org>
prev parent reply other threads:[~2012-01-24 8:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-20 14:57 [PATCH 0/3] fixes for tcp memcg Glauber Costa
2012-01-20 14:57 ` [PATCH 1/3] net: fix socket memcg build with !CONFIG_NET Glauber Costa
[not found] ` <1327071436-20763-2-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-01-20 19:14 ` David Miller
[not found] ` <20120120.141446.136970067758991080.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2012-01-21 14:17 ` Glauber Costa
[not found] ` <4F1AC8F6.1060703-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-01-22 19:35 ` David Miller
[not found] ` <1327071436-20763-1-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-01-20 14:57 ` [PATCH 2/3] cgroup: make sure memcg margin is 0 when over limit Glauber Costa
[not found] ` <1327071436-20763-3-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-01-20 17:08 ` Tejun Heo
2012-01-24 8:12 ` Johannes Weiner
2012-01-20 14:57 ` [PATCH 3/3] net: introduce res_counter_charge_nofail() for socket allocations Glauber Costa
[not found] ` <1327071436-20763-4-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-01-20 17:07 ` Tejun Heo
2012-01-24 8:15 ` Johannes Weiner [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=20120124081552.GB1660@cmpxchg.org \
--to=hannes-druugvl0lcnafugrpc6u6w@public$(echo .)gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
--cc=chavey-hpIqsD4AKlfQT0dZR+AlfA@public$(echo .)gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public$(echo .)gmane.org \
--cc=eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public$(echo .)gmane.org \
--cc=glommer-bzQdu9zFT3WakBO8gow8eQ@public$(echo .)gmane.org \
--cc=kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public$(echo .)gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
--cc=lizf-BthXqXjhjHXQFUHtdCDX3A@public$(echo .)gmane.org \
--cc=mhocko-AlSwsSmVLrQ@public$(echo .)gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public$(echo .)gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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