From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org,
linux-rt-users <linux-rt-users@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Carsten Emde <C.Emde@osadl.org>, John Kacur <jkacur@redhat.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Hans Schillstrom <hans@schillstrom.com>,
Christoph Lameter <cl@gentwo.org>,
Pekka Enberg <penberg@cs.helsinki.fi>,
Matt Mackall <mpm@selenic.com>,
Sitsofe Wheeler <sitsofe@yahoo.com>,
linux-mm@kvack.org, David Rientjes <rientjes@google.com>
Subject: [PATCH 10/11] slab, lockdep: Annotate all slab caches
Date: Sun, 04 Dec 2011 13:54:54 -0500 [thread overview]
Message-ID: <20111204190023.776869305@goodmis.org> (raw)
In-Reply-To: 20111204185444.411298317@goodmis.org
[-- Attachment #1: Type: text/plain, Size: 3777 bytes --]
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
Currently we only annotate the kmalloc caches, annotate all of them.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Hans Schillstrom <hans@schillstrom.com>
Cc: Christoph Lameter <cl@gentwo.org>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Sitsofe Wheeler <sitsofe@yahoo.com>
Cc: linux-mm@kvack.org
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/n/tip-10bey2cgpcvtbdkgigaoab8w@git.kernel.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
mm/slab.c | 52 ++++++++++++++++++++++++++++------------------------
1 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 433b9a2..5251b99 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -606,6 +606,12 @@ int slab_is_available(void)
return g_cpucache_up >= EARLY;
}
+/*
+ * Guard access to the cache-chain.
+ */
+static DEFINE_MUTEX(cache_chain_mutex);
+static struct list_head cache_chain;
+
#ifdef CONFIG_LOCKDEP
/*
@@ -667,38 +673,41 @@ static void slab_set_debugobj_lock_classes(struct kmem_cache *cachep)
slab_set_debugobj_lock_classes_node(cachep, node);
}
-static void init_node_lock_keys(int q)
+static void init_lock_keys(struct kmem_cache *cachep, int node)
{
- struct cache_sizes *s = malloc_sizes;
+ struct kmem_list3 *l3;
if (g_cpucache_up < LATE)
return;
- for (s = malloc_sizes; s->cs_size != ULONG_MAX; s++) {
- struct kmem_list3 *l3;
+ l3 = cachep->nodelists[node];
+ if (!l3 || OFF_SLAB(cachep))
+ return;
- l3 = s->cs_cachep->nodelists[q];
- if (!l3 || OFF_SLAB(s->cs_cachep))
- continue;
+ slab_set_lock_classes(cachep, &on_slab_l3_key, &on_slab_alc_key, node);
+}
- slab_set_lock_classes(s->cs_cachep, &on_slab_l3_key,
- &on_slab_alc_key, q);
- }
+static void init_node_lock_keys(int node)
+{
+ struct kmem_cache *cachep;
+
+ list_for_each_entry(cachep, &cache_chain, next)
+ init_lock_keys(cachep, node);
}
-static inline void init_lock_keys(void)
+static inline void init_cachep_lock_keys(struct kmem_cache *cachep)
{
int node;
for_each_node(node)
- init_node_lock_keys(node);
+ init_lock_keys(cachep, node);
}
#else
-static void init_node_lock_keys(int q)
+static void init_node_lock_keys(int node)
{
}
-static inline void init_lock_keys(void)
+static void init_cachep_lock_keys(struct kmem_cache *cachep)
{
}
@@ -711,12 +720,6 @@ static void slab_set_debugobj_lock_classes(struct kmem_cache *cachep)
}
#endif
-/*
- * Guard access to the cache-chain.
- */
-static DEFINE_MUTEX(cache_chain_mutex);
-static struct list_head cache_chain;
-
static DEFINE_PER_CPU(struct delayed_work, slab_reap_work);
static DEFINE_PER_CPU(struct list_head, slab_free_list);
static DEFINE_LOCAL_IRQ_LOCK(slab_lock);
@@ -1728,14 +1731,13 @@ void __init kmem_cache_init_late(void)
g_cpucache_up = LATE;
- /* Annotate slab for lockdep -- annotate the malloc caches */
- init_lock_keys();
-
/* 6) resize the head arrays to their final sizes */
mutex_lock(&cache_chain_mutex);
- list_for_each_entry(cachep, &cache_chain, next)
+ list_for_each_entry(cachep, &cache_chain, next) {
+ init_cachep_lock_keys(cachep);
if (enable_cpucache(cachep, GFP_NOWAIT))
BUG();
+ }
mutex_unlock(&cache_chain_mutex);
/* Done! */
@@ -2546,6 +2548,8 @@ kmem_cache_create (const char *name, size_t size, size_t align,
slab_set_debugobj_lock_classes(cachep);
}
+ init_cachep_lock_keys(cachep);
+
/* cache setup completed, link it into the list */
list_add(&cachep->next, &cache_chain);
oops:
--
1.7.7.1
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2011-12-04 18:54 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-04 18:54 [PATCH 00/11] [ANNOUNCE] 3.0.12-rt30-rc2 Steven Rostedt
2011-12-04 18:54 ` [PATCH 01/11] tasklet/rt: Prevent tasklets from going into infinite spin in RT Steven Rostedt
2011-12-04 18:54 ` [PATCH 02/11] genirq: fix regression in irqfixup, irqpoll Steven Rostedt
2011-12-04 18:54 ` [PATCH 03/11] intel-iommu: Fix AB-BA lockdep report Steven Rostedt
2012-11-14 2:25 ` Shuah Khan
2012-11-14 3:04 ` Steven Rostedt
2012-11-14 3:34 ` Greg Kroah-Hartman
2012-11-14 3:43 ` Steven Rostedt
2012-11-14 3:43 ` Steven Rostedt
2012-11-14 15:58 ` Shuah Khan
2011-12-04 18:54 ` [PATCH 04/11] KVM: Sanitize cpuid Steven Rostedt
2011-12-04 18:54 ` [PATCH 05/11] KVM: fix XSAVE bit scanning (now properly) Steven Rostedt
2011-12-04 18:54 ` [PATCH 06/11] wait: Provide __wake_up_all_locked Steven Rostedt
2011-12-04 18:54 ` [PATCH 07/11] pci: Use __wake_up_all_locked pci_unblock_user_cfg_access() Steven Rostedt
2011-12-04 18:54 ` [PATCH 08/11] acpi: Make gbl_[hardware|gpe]_lock raw Steven Rostedt
2011-12-04 18:54 ` [PATCH 09/11] slab, lockdep: Fix silly bug Steven Rostedt
2011-12-05 13:04 ` Pekka Enberg
2011-12-05 13:04 ` Pekka Enberg
2011-12-05 13:15 ` Steven Rostedt
2011-12-05 13:15 ` Steven Rostedt
2011-12-04 18:54 ` Steven Rostedt [this message]
2011-12-04 18:54 ` [PATCH 11/11] Linux v3.0.12-rt30-rc2 Steven Rostedt
2011-12-04 20:13 ` [PATCH 00/11] [ANNOUNCE] 3.0.12-rt30-rc2 Tim Sander
2011-12-04 20:46 ` Thomas Gleixner
2011-12-05 9:11 ` Tim Sander
2011-12-05 13:23 ` Steven Rostedt
2011-12-07 8:09 ` Tim Sander
2011-12-07 8:09 ` Tim Sander
2011-12-05 2:58 ` Mike Galbraith
2011-12-05 15:12 ` Georgiewskiy Yuriy
2011-12-05 15:12 ` Georgiewskiy Yuriy
2011-12-05 16:57 ` Thomas Gleixner
2011-12-05 20:01 ` Georgiewskiy Yuriy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111204190023.776869305@goodmis.org \
--to=rostedt@goodmis.org \
--cc=C.Emde@osadl.org \
--cc=a.p.zijlstra@chello.nl \
--cc=cl@gentwo.org \
--cc=hans@schillstrom.com \
--cc=jkacur@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=penberg@cs.helsinki.fi \
--cc=rientjes@google.com \
--cc=sitsofe@yahoo.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.