[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1101050943120.13032@router.home>
Date: Wed, 5 Jan 2011 09:51:02 -0600 (CST)
From: Christoph Lameter <cl@...ux.com>
To: David Rientjes <rientjes@...gle.com>
cc: Pekka Enberg <penberg@...nel.org>, linux-kernel@...r.kernel.org,
Bart Van Assche <bart.vanassche@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] slub: Fix sysfs circular locking dependency
On Tue, 4 Jan 2011, David Rientjes wrote:
> slub_lock protects slab_state following kmem_cache_init() if caches are
> created/destroyed prior to the sysfs slab initcall setting the global
> variable, so couldn't this leak the kobject if its initialization and add
> was deferred on kmem_cache_create() and added by slab_sysfs_init()?
Potentially.
Also note that the same lock inversion occurs in kmem_cache_create().
slub lock is taken and then sysfs operations are performed.
The problem is that slub_lock has multiple roles:
1. Protect the list of slab caches and the slab_state (thats why its
mainly used in kmem_cache_destroy and kmem_cache_create)
2. Protect against removal and adding of new cpus and nodes
(show_slab_objects)
If we could create another lock that protects against new cpus / nodes
being added and removed then we could take that lock in
show_slab_objects() instead.
IMHO the lock order must have the slub_lock at the top.
The other lock that would prevent adding/removal of nodes / cpu can be
taken in show_slab_objects and in the corresponding hotplug functions. We
do not need to take the lock at all in show_slab_objects cpu and memory
hotplug are not enabled. Maybe there is a hotplug specific lock that can
be used instead?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists