From patchwork Mon Apr 30 10:01:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 8309 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 8C39923E13 for ; Mon, 30 Apr 2012 10:03:02 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 44CF4A181A4 for ; Mon, 30 Apr 2012 10:03:02 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so5452583iag.11 for ; Mon, 30 Apr 2012 03:03:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:date:from :to:cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent:x-gm-message-state; bh=hnw7gfm6XM1qqAck+DZsR8nuPLJbXErm5U2Fy6gnPxI=; b=Nx9DkUsaROeNi86jCeRRxgoOlhHF1Ph6AsRe5YuZB2UHa6WLeLNquMnY5SfUi1dRnT VrUrPWRO7fLVtOknfHszudWdrv9RH4sgmGAmY/GjsaYbY04O1+pmERE+kcxPPezDNnGu ZFp0eNCQ9UjS/+hgXs8Fx/EOwjO1sNiuYX2FcU4bnQe1fN3SyNIE9KLLpWq4vpwTg6Fc oFlx8WMaIgqKBZIXTLyNFpYNLFfuv1SvcvpkolEHVJclOaRald3YOh8pfjQXkSMU+siq rJDzbivvIT6gZ+RXpxPhm4PWgvMuIMdG1E4o/aVzGYDj1WjzVGYGFCuKZJSNnGKZSOuX yoMw== Received: by 10.50.181.164 with SMTP id dx4mr9807525igc.1.1335780182063; Mon, 30 Apr 2012 03:03:02 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.137.198 with SMTP id x6csp104586ibt; Mon, 30 Apr 2012 03:03:01 -0700 (PDT) Received: by 10.68.229.37 with SMTP id sn5mr11082462pbc.29.1335780180853; Mon, 30 Apr 2012 03:03:00 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id d1si14761234pbq.113.2012.04.30.03.03.00 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Apr 2012 03:03:00 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) smtp.mail=anton.vorontsov@linaro.org Received: by mail-pb0-f50.google.com with SMTP id xa12so4134281pbc.37 for ; Mon, 30 Apr 2012 03:03:00 -0700 (PDT) Received: by 10.68.219.34 with SMTP id pl2mr2482123pbc.56.1335780180585; Mon, 30 Apr 2012 03:03:00 -0700 (PDT) Received: from localhost (c-71-204-165-222.hsd1.ca.comcast.net. [71.204.165.222]) by mx.google.com with ESMTPS id pn10sm14038941pbb.22.2012.04.30.03.02.58 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Apr 2012 03:02:59 -0700 (PDT) Date: Mon, 30 Apr 2012 03:01:39 -0700 From: Anton Vorontsov To: Glauber Costa Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, devel@openvz.org, kamezawa.hiroyu@jp.fujitsu.com, Michal Hocko , Johannes Weiner , Frederic Weisbecker , Greg Thelen , Suleiman Souhlal , John Stultz , linaro-kernel@lists.linaro.org, patches@linaro.org Subject: [PATCH 2/3] slab: Fix imbalanced rcu locking Message-ID: <20120430100138.GB28569@lizard> References: <20120430095918.GA13824@lizard> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120430095918.GA13824@lizard> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQkxCvcnWGXpJjOpcKErDGsazkKw4WS4KYqeR+KNAISUTKLnbrR1G4RBKDIlfqeygy1r3mU3 Not sure why the code tries to unlock the rcu. The only case where slab grabs the lock is around mem_cgroup_get_kmem_cache() call, which won't result into calling cache_grow() (that tries to unlock the rcu). ===================================== [ BUG: bad unlock balance detected! ] 3.4.0-rc4+ #33 Not tainted ------------------------------------- swapper/0/0 is trying to release lock (rcu_read_lock) at: [] cache_grow.constprop.63+0xe8/0x371 but there are no more locks to release! other info that might help us debug this: no locks held by swapper/0/0. stack backtrace: Pid: 0, comm: swapper/0 Not tainted 3.4.0-rc4+ #33 Call Trace: [] ? cache_grow.constprop.63+0xe8/0x371 [] print_unlock_inbalance_bug.part.26+0xd1/0xd9 [] ? cache_grow.constprop.63+0xe8/0x371 [] print_unlock_inbalance_bug+0x4e/0x50 [] ? cache_grow.constprop.63+0xe8/0x371 [] __lock_release+0xd6/0xe0 [] lock_release+0x5c/0x80 [] cache_grow.constprop.63+0x100/0x371 [] cache_alloc_refill+0x289/0x2dc [] ? kmem_cache_alloc+0x92/0x260 [] ? pidmap_init+0x79/0xb2 [] kmem_cache_alloc+0x252/0x260 [] ? kmem_freepages+0x180/0x180 [] pidmap_init+0x79/0xb2 [] start_kernel+0x297/0x2f8 [] ? repair_env_string+0x5a/0x5a [] x86_64_start_reservations+0x101/0x105 [] x86_64_start_kernel+0xf0/0xf7 Signed-off-by: Anton Vorontsov --- include/linux/slab_def.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index c4f7e45..2d371ae 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h @@ -245,13 +245,11 @@ mem_cgroup_kmem_cache_prepare_sleep(struct kmem_cache *cachep) * enabled. */ kmem_cache_get_ref(cachep); - rcu_read_unlock(); } static inline void mem_cgroup_kmem_cache_finish_sleep(struct kmem_cache *cachep) { - rcu_read_lock(); kmem_cache_drop_ref(cachep); }