From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753946Ab2LYP1t (ORCPT ); Tue, 25 Dec 2012 10:27:49 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:38111 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753861Ab2LYP1r (ORCPT ); Tue, 25 Dec 2012 10:27:47 -0500 From: Joonsoo Kim To: Pekka Enberg Cc: Paul Hargrove , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Joonsoo Kim , Christoph Lameter Subject: [PATCH] slub: assign refcount for kmalloc_caches Date: Wed, 26 Dec 2012 00:24:42 +0900 Message-Id: <1356449082-3016-1-git-send-email-js1304@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit cce89f4f6911286500cf7be0363f46c9b0a12ce0('Move kmem_cache refcounting to common code') moves some refcount manipulation code to common code. Unfortunately, it also removed refcount assignment for kmalloc_caches. So, kmalloc_caches's refcount is initially 0. This makes errornous situation. Paul Hargrove report that when he create a 8-byte kmem_cache and destory it, he encounter below message. 'Objects remaining in kmalloc-8 on kmem_cache_close()' 8-byte kmem_cache merge with 8-byte kmalloc cache and refcount is increased by one. So, resulting refcount is 1. When destory it, it hit refcount = 0, then kmem_cache_close() is executed and error message is printed. This patch assign initial refcount 1 to kmalloc_caches, so fix this errornous situtation. Cc: # v3.7 Cc: Christoph Lameter Reported-by: Paul Hargrove Signed-off-by: Joonsoo Kim diff --git a/mm/slub.c b/mm/slub.c index a0d6984..321afab 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3279,6 +3279,7 @@ static struct kmem_cache *__init create_kmalloc_cache(const char *name, if (kmem_cache_open(s, flags)) goto panic; + s->refcount = 1; list_add(&s->list, &slab_caches); return s; -- 1.7.9.5