Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751976AbaKESnf (ORCPT ); Wed, 5 Nov 2014 13:43:35 -0500 Received: from resqmta-po-06v.sys.comcast.net ([96.114.154.165]:58650 "EHLO resqmta-po-06v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751535AbaKESne (ORCPT ); Wed, 5 Nov 2014 13:43:34 -0500 Date: Wed, 5 Nov 2014 12:43:31 -0600 (CST) From: Christoph Lameter X-X-Sender: cl@gentwo.org To: Vladimir Davydov cc: Andrew Morton , Johannes Weiner , Michal Hocko , Pekka Enberg , David Rientjes , Joonsoo Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -mm 8/8] slab: recharge slab pages to the allocating memory cgroup In-Reply-To: Message-ID: References: Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 3 Nov 2014, Vladimir Davydov wrote: > +static __always_inline void slab_free(struct kmem_cache *cachep, void *objp); > + > static __always_inline void * > slab_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid, > unsigned long caller) > @@ -3185,6 +3187,10 @@ slab_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid, > kmemcheck_slab_alloc(cachep, flags, ptr, cachep->object_size); > if (unlikely(flags & __GFP_ZERO)) > memset(ptr, 0, cachep->object_size); > + if (unlikely(memcg_kmem_recharge_slab(ptr, flags))) { > + slab_free(cachep, ptr); > + ptr = NULL; > + } > } > > return ptr; > @@ -3250,6 +3256,10 @@ slab_alloc(struct kmem_cache *cachep, gfp_t flags, unsigned long caller) > kmemcheck_slab_alloc(cachep, flags, objp, cachep->object_size); > if (unlikely(flags & __GFP_ZERO)) > memset(objp, 0, cachep->object_size); > + if (unlikely(memcg_kmem_recharge_slab(objp, flags))) { > + slab_free(cachep, objp); > + objp = NULL; > + } > } > Please do not add code to the hotpaths if its avoidable. Can you charge the full slab only when allocated please? -- 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/