linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* kmem_cache_destroy() badness with SLUB
@ 2010-06-28  1:31 Benjamin Herrenschmidt
  2010-06-28  9:03 ` David Rientjes
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2010-06-28  1:31 UTC (permalink / raw)
  To: linux-mm; +Cc: Christoph Lameter, linux-kernel@vger.kernel.org

Hi folks !

Internally, I'm hitting a little "nit"...

sysfs_slab_add() has this check:

	if (slab_state < SYSFS)
		/* Defer until later */
		return 0;

But sysfs_slab_remove() doesn't.

So if the slab is created -and- destroyed at, for example, arch_initcall
time, then we hit a WARN in the kobject code, trying to dispose of a
non-existing kobject.

Now, at first sight, just adding the same test to sysfs_slab_remove()
would do the job... but it all seems very racy to me.

I don't understand in fact how this slab_state deals with races at all. 

What prevents us from hitting slab_sysfs_init() at the same time as
another CPU deos sysfs_slab_add() ? How do that deal with collisions
trying to register the same kobject twice ? Similar race with remove...

Shouldn't we have a mutex around those guys ?

Cheers,
Ben.


--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-07-06  3:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-28  1:31 kmem_cache_destroy() badness with SLUB Benjamin Herrenschmidt
2010-06-28  9:03 ` David Rientjes
2010-06-28 21:44   ` Benjamin Herrenschmidt
2010-06-29 15:47 ` Christoph Lameter
2010-07-06  3:58 ` Roland Dreier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).