From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx109.postini.com [74.125.245.109]) by kanga.kvack.org (Postfix) with SMTP id 856986B005C for ; Sun, 4 Dec 2011 14:00:26 -0500 (EST) Message-Id: <20111204190023.776869305@goodmis.org> Date: Sun, 04 Dec 2011 13:54:54 -0500 From: Steven Rostedt Subject: [PATCH 10/11] slab, lockdep: Annotate all slab caches References: <20111204185444.411298317@goodmis.org> Content-Disposition: inline; filename=0010-slab-lockdep-Annotate-all-slab-caches.patch Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="00GvhwF7k39YY" Sender: owner-linux-mm@kvack.org List-ID: To: linux-kernel@vger.kernel.org, linux-rt-users Cc: Thomas Gleixner , Carsten Emde , John Kacur , Peter Zijlstra , Hans Schillstrom , Christoph Lameter , Pekka Enberg , Matt Mackall , Sitsofe Wheeler , linux-mm@kvack.org, David Rientjes --00GvhwF7k39YY Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: Peter Zijlstra Currently we only annotate the kmalloc caches, annotate all of them. Signed-off-by: Peter Zijlstra Cc: Hans Schillstrom Cc: Christoph Lameter Cc: Pekka Enberg Cc: Matt Mackall Cc: Sitsofe Wheeler Cc: linux-mm@kvack.org Cc: David Rientjes Signed-off-by: Thomas Gleixner Link: http://lkml.kernel.org/n/tip-10bey2cgpcvtbdkgigaoab8w@git.kernel.org Signed-off-by: Steven Rostedt --- 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 >=3D EARLY; } =20 +/* + * Guard access to the cache-chain. + */ +static DEFINE_MUTEX(cache_chain_mutex); +static struct list_head cache_chain; + #ifdef CONFIG_LOCKDEP =20 /* @@ -667,38 +673,41 @@ static void slab_set_debugobj_lock_classes(struct kme= m_cache *cachep) slab_set_debugobj_lock_classes_node(cachep, node); } =20 -static void init_node_lock_keys(int q) +static void init_lock_keys(struct kmem_cache *cachep, int node) { - struct cache_sizes *s =3D malloc_sizes; + struct kmem_list3 *l3; =20 if (g_cpucache_up < LATE) return; =20 - for (s =3D malloc_sizes; s->cs_size !=3D ULONG_MAX; s++) { - struct kmem_list3 *l3; + l3 =3D cachep->nodelists[node]; + if (!l3 || OFF_SLAB(cachep)) + return; =20 - l3 =3D 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); +} =20 - 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); } =20 -static inline void init_lock_keys(void) +static inline void init_cachep_lock_keys(struct kmem_cache *cachep) { int node; =20 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) { } =20 -static inline void init_lock_keys(void) +static void init_cachep_lock_keys(struct kmem_cache *cachep) { } =20 @@ -711,12 +720,6 @@ static void slab_set_debugobj_lock_classes(struct kmem= _cache *cachep) } #endif =20 -/* - * 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) =20 g_cpucache_up =3D LATE; =20 - /* 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); =20 /* Done! */ @@ -2546,6 +2548,8 @@ kmem_cache_create (const char *name, size_t size, siz= e_t align, slab_set_debugobj_lock_classes(cachep); } =20 + init_cachep_lock_keys(cachep); + /* cache setup completed, link it into the list */ list_add(&cachep->next, &cache_chain); oops: --=20 1.7.7.1 --00GvhwF7k39YY Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJO28NIAAoJEIy3vGnGbaoAaO0P/37+w7akCR2Veg0qUDhlLngk fBMGo5TOuUAYyFhLiTi8lMzVB6l1yOnogvF59gcuB55HdBG4Mezy5jRBtslygFbs ZPjjb9JHkPKb/5d/VCZCVa3MDSbE/Q1TO2hPDn6wNt+D8YUqe0xwJRG2ZKw/zbb1 yAVpF6qVAAPOklPC6DmOmub7zM1hMMUi7QGaw5uhV0mgwqVFEnW9p+1LQqSVVFGG lRfCtEmhgtN2zDjPozbnggj6GSKFQvAOwZUhixcTgDKmOjbO3eNuB31w9i+kOulu aFQJbetj6D+LGRdACUk9Yu3Ds/CSsGaygp5MBud+7fDhfRpA3Ey9vnXOLX1m4LMX xZVeMdM+b1VRhsROaOxsIZDtWJe/GDdAnypZuKCFeD38Op9pDYEEIjvQCTEwLbzD 65o4FmG0JZW5H/Mj7HICiTyWRyxTGhO7lv0Xze3ltBgoQ5w0ARU7+Vf0qA/XPLS+ 4HY5zas1mcYrVk9++Wr6BYpt4yGUbUOYxU4GYgc5Ud8VbqMHFFPfxpOlEiPAeMJa RmNLLeUQ60EVM3xIOToTmQQCAfBYrxurVsaXOCLhYyfvoNiqj4w277WbdjSF05ba IxVCcX7Ypt8DNt4acgyjJIFFLncvhIyVGjX61ZcAORoalRNXK740JM8pimabMd+9 88GM5uglvP8hBfPQbq/p =jO8C -----END PGP SIGNATURE----- --00GvhwF7k39YY-- -- 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/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org