lkml.org 
[lkml]   [2012]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 3/3] net: introduce res_counter_charge_nofail() for socket allocations
    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@parallels.com>
    > Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    > Cc: Johannes Weiner <hannes@cmpxchg.org>
    > Cc: Michal Hocko <mhocko@suse.cz>
    > CC: Tejun Heo <tj@kernel.org>
    > CC: Li Zefan <lizf@cn.fujitsu.com>
    > CC: Laurent Chavey <chavey@google.com>

    Acked-by: Johannes Weiner <hannes@cmpxchg.org>


    \
     
     \ /
      Last update: 2012-01-24 09:19    [W:0.030 / U:0.212 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site