Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932572AbbKMExn (ORCPT ); Thu, 12 Nov 2015 23:53:43 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:35805 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754220AbbKMExl (ORCPT ); Thu, 12 Nov 2015 23:53:41 -0500 Message-ID: <1447390418.22599.34.camel@edumazet-glaptop2.roam.corp.google.com> Subject: Re: [PATCH 08/14] net: tcp_memcontrol: sanitize tcp memory accounting callbacks From: Eric Dumazet To: Johannes Weiner Cc: David Miller , Andrew Morton , Vladimir Davydov , Tejun Heo , Michal Hocko , netdev@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Date: Thu, 12 Nov 2015 20:53:38 -0800 In-Reply-To: <1447371693-25143-9-git-send-email-hannes@cmpxchg.org> References: <1447371693-25143-1-git-send-email-hannes@cmpxchg.org> <1447371693-25143-9-git-send-email-hannes@cmpxchg.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1584 Lines: 53 On Thu, 2015-11-12 at 18:41 -0500, Johannes Weiner wrote: > @@ -711,6 +705,12 @@ static inline void mem_cgroup_wb_stats(struct bdi_writeback *wb, > struct sock; > void sock_update_memcg(struct sock *sk); > void sock_release_memcg(struct sock *sk); > +bool mem_cgroup_charge_skmem(struct cg_proto *proto, unsigned int nr_pages); > +void mem_cgroup_uncharge_skmem(struct cg_proto *proto, unsigned int nr_pages); > +static inline bool mem_cgroup_under_socket_pressure(struct cg_proto *proto) > +{ > + return proto->memory_pressure; > +} > #endif /* CONFIG_INET && CONFIG_MEMCG_KMEM */ > > #ifdef CONFIG_MEMCG_KMEM > diff --git a/include/net/sock.h b/include/net/sock.h > index 2eefc99..8cc7613 100644 > --- a/include/net/sock.h > +++ b/include/net/sock.h > @@ -1126,8 +1126,8 @@ static inline bool sk_under_memory_pressure(const struct sock *sk) > if (!sk->sk_prot->memory_pressure) > return false; > > - if (mem_cgroup_sockets_enabled && sk->sk_cgrp) > - return !!sk->sk_cgrp->memory_pressure; > + if (mem_cgroup_sockets_enabled && sk->sk_cgrp && > + mem_cgroup_under_socket_pressure(sk->sk_cgrp)) > > return !!*sk->sk_prot->memory_pressure; > } This looks wrong ? if (A && B && C) return !!*sk->sk_prot->memory_pressure; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/