From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: [PATCH v3 15/16] memcg/sl[au]b: shrink dead caches Date: Fri, 21 Sep 2012 13:40:35 -0700 Message-ID: <20120921204035.GQ7264@google.com> References: <1347977530-29755-1-git-send-email-glommer@parallels.com> <1347977530-29755-16-git-send-email-glommer@parallels.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=Z7TjXtppKeHBTYdkrqAm1ctaw4UZUWCe56o3zSOBHhU=; b=rBdn9ar2/8rQrJ32Zb8+Zc11wEouvqGel02xYxSkcWSCtOv0LyxFkph6vnrGfTAhOS AI8BsE5bloJTjlVl26Wm75AICA9/LQLUlJ/WE7EaOWbVL1M8XT6Y+FK2KzD2vtZIKTV0 Af9QFlFAbgXO5JaXXkhcTH2KDV6P2RVEG8lSFPGWNCTcdhDJaLzyTCfw4n15w+c6q55y gXAZMA79/p7iewJ0DaoVRVBx8swYRLn4VCESIr04nfcpKLUyO9/OxYl8I20KB337qwBx cVmnG6RVV9YPsAwkJtoNDzb9W7uNR3JvoL0PqlldFhU8Re/XgoOhQnq2mhjds10hry9V taDg== Content-Disposition: inline In-Reply-To: <1347977530-29755-16-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Glauber Costa Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org, devel-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Suleiman Souhlal , Frederic Weisbecker , Mel Gorman , David Rientjes , Christoph Lameter , Pekka Enberg , Michal Hocko , Johannes Weiner Hello, Glauber. On Tue, Sep 18, 2012 at 06:12:09PM +0400, Glauber Costa wrote: > @@ -764,10 +777,21 @@ static struct kmem_cache *memcg_create_kmem_cache(struct mem_cgroup *memcg, > goto out; > } > > + /* > + * Because the cache is expected to duplicate the string, > + * we must make sure it has opportunity to copy its full > + * name. Only now we can remove the dead part from it > + */ > + name = (char *)new_cachep->name; > + if (name) > + name[strlen(name) - 4] = '\0'; This is kinda nasty. Do we really need to do this? How long would a dead cache stick around? > diff --git a/mm/slab.c b/mm/slab.c > index bd9928f..6cb4abf 100644 > --- a/mm/slab.c > +++ b/mm/slab.c > @@ -3785,6 +3785,8 @@ static inline void __cache_free(struct kmem_cache *cachep, void *objp, > } > > ac_put_obj(cachep, ac, objp); > + > + kmem_cache_verify_dead(cachep); Reaping dead caches doesn't exactly sound like a high priority thing and adding a branch to hot path for that might not be the best way to do it. Why not schedule an extremely lazy deferrable delayed_work which polls for emptiness, say, every miniute or whatever? Thanks. -- tejun From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx168.postini.com [74.125.245.168]) by kanga.kvack.org (Postfix) with SMTP id A207D6B005D for ; Fri, 21 Sep 2012 16:40:40 -0400 (EDT) Received: by pbbro12 with SMTP id ro12so9099302pbb.14 for ; Fri, 21 Sep 2012 13:40:39 -0700 (PDT) Date: Fri, 21 Sep 2012 13:40:35 -0700 From: Tejun Heo Subject: Re: [PATCH v3 15/16] memcg/sl[au]b: shrink dead caches Message-ID: <20120921204035.GQ7264@google.com> References: <1347977530-29755-1-git-send-email-glommer@parallels.com> <1347977530-29755-16-git-send-email-glommer@parallels.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1347977530-29755-16-git-send-email-glommer@parallels.com> Sender: owner-linux-mm@kvack.org List-ID: To: Glauber Costa Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, kamezawa.hiroyu@jp.fujitsu.com, devel@openvz.org, linux-mm@kvack.org, Suleiman Souhlal , Frederic Weisbecker , Mel Gorman , David Rientjes , Christoph Lameter , Pekka Enberg , Michal Hocko , Johannes Weiner Hello, Glauber. On Tue, Sep 18, 2012 at 06:12:09PM +0400, Glauber Costa wrote: > @@ -764,10 +777,21 @@ static struct kmem_cache *memcg_create_kmem_cache(struct mem_cgroup *memcg, > goto out; > } > > + /* > + * Because the cache is expected to duplicate the string, > + * we must make sure it has opportunity to copy its full > + * name. Only now we can remove the dead part from it > + */ > + name = (char *)new_cachep->name; > + if (name) > + name[strlen(name) - 4] = '\0'; This is kinda nasty. Do we really need to do this? How long would a dead cache stick around? > diff --git a/mm/slab.c b/mm/slab.c > index bd9928f..6cb4abf 100644 > --- a/mm/slab.c > +++ b/mm/slab.c > @@ -3785,6 +3785,8 @@ static inline void __cache_free(struct kmem_cache *cachep, void *objp, > } > > ac_put_obj(cachep, ac, objp); > + > + kmem_cache_verify_dead(cachep); Reaping dead caches doesn't exactly sound like a high priority thing and adding a branch to hot path for that might not be the best way to do it. Why not schedule an extremely lazy deferrable delayed_work which polls for emptiness, say, every miniute or whatever? Thanks. -- tejun -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757918Ab2IUUkm (ORCPT ); Fri, 21 Sep 2012 16:40:42 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:35874 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757807Ab2IUUkk (ORCPT ); Fri, 21 Sep 2012 16:40:40 -0400 Date: Fri, 21 Sep 2012 13:40:35 -0700 From: Tejun Heo To: Glauber Costa Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, kamezawa.hiroyu@jp.fujitsu.com, devel@openvz.org, linux-mm@kvack.org, Suleiman Souhlal , Frederic Weisbecker , Mel Gorman , David Rientjes , Christoph Lameter , Pekka Enberg , Michal Hocko , Johannes Weiner Subject: Re: [PATCH v3 15/16] memcg/sl[au]b: shrink dead caches Message-ID: <20120921204035.GQ7264@google.com> References: <1347977530-29755-1-git-send-email-glommer@parallels.com> <1347977530-29755-16-git-send-email-glommer@parallels.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1347977530-29755-16-git-send-email-glommer@parallels.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Glauber. On Tue, Sep 18, 2012 at 06:12:09PM +0400, Glauber Costa wrote: > @@ -764,10 +777,21 @@ static struct kmem_cache *memcg_create_kmem_cache(struct mem_cgroup *memcg, > goto out; > } > > + /* > + * Because the cache is expected to duplicate the string, > + * we must make sure it has opportunity to copy its full > + * name. Only now we can remove the dead part from it > + */ > + name = (char *)new_cachep->name; > + if (name) > + name[strlen(name) - 4] = '\0'; This is kinda nasty. Do we really need to do this? How long would a dead cache stick around? > diff --git a/mm/slab.c b/mm/slab.c > index bd9928f..6cb4abf 100644 > --- a/mm/slab.c > +++ b/mm/slab.c > @@ -3785,6 +3785,8 @@ static inline void __cache_free(struct kmem_cache *cachep, void *objp, > } > > ac_put_obj(cachep, ac, objp); > + > + kmem_cache_verify_dead(cachep); Reaping dead caches doesn't exactly sound like a high priority thing and adding a branch to hot path for that might not be the best way to do it. Why not schedule an extremely lazy deferrable delayed_work which polls for emptiness, say, every miniute or whatever? Thanks. -- tejun