Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759010Ab2JSOWj (ORCPT ); Fri, 19 Oct 2012 10:22:39 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:46728 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758925Ab2JSOWb (ORCPT ); Fri, 19 Oct 2012 10:22:31 -0400 From: Glauber Costa To: Cc: , , Mel Gorman , Tejun Heo , Andrew Morton , Michal Hocko , Johannes Weiner , , Christoph Lameter , David Rientjes , Pekka Enberg , , Glauber Costa , Pekka Enberg , Suleiman Souhlal Subject: [PATCH v5 04/18] slab: don't preemptively remove element from list in cache destroy Date: Fri, 19 Oct 2012 18:20:28 +0400 Message-Id: <1350656442-1523-5-git-send-email-glommer@parallels.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1350656442-1523-1-git-send-email-glommer@parallels.com> References: <1350656442-1523-1-git-send-email-glommer@parallels.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1797 Lines: 53 After the slab/slub/slob merge, we are deleting the element from the slab_cache lists, and then if the destruction fail, we add it back again. This behavior was present in some caches, but not in others, if my memory doesn't fail me. I, however, see no reason why we need to do so, since we are now locked during the whole deletion (which wasn't necessarily true before). I propose a simplification in which we delete it only when there is no more going back, so we don't need to add it again. Signed-off-by: Glauber Costa CC: Christoph Lameter CC: Pekka Enberg CC: Michal Hocko CC: Kamezawa Hiroyuki CC: Johannes Weiner CC: Suleiman Souhlal CC: Tejun Heo --- mm/slab_common.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index 1ee1d6f..bf4b4f1 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -174,16 +174,15 @@ void kmem_cache_destroy(struct kmem_cache *s) mutex_lock(&slab_mutex); s->refcount--; if (!s->refcount) { - list_del(&s->list); - if (!__kmem_cache_shutdown(s)) { if (s->flags & SLAB_DESTROY_BY_RCU) rcu_barrier(); + list_del(&s->list); + kfree(s->name); kmem_cache_free(kmem_cache, s); } else { - list_add(&s->list, &slab_caches); printk(KERN_ERR "kmem_cache_destroy %s: Slab cache still has objects\n", s->name); dump_stack(); -- 1.7.11.7 -- 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/