mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* SLUB: kmem_cache_destroy doesn't
@ 2007-04-12  7:27 Neil Brown
  2007-04-12 16:38 ` Christoph Lameter
  0 siblings, 1 reply; 2+ messages in thread
From: Neil Brown @ 2007-04-12  7:27 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: linux-kernel


I tried out SLOB in latest mm.
raid5 uses kmem_cache_create to create a cache, a deletes it with
kmem_cache_destroy.

After I change the name for the slab to not include a '/' the create
worked fine, but the destroy seems incomplete.
If I stop an array and restart it, the second kmem_cache_create fails
because it thinks the name is already in use.

If I look in sysfs, I can see it there.
And 

  # cat /sys/slab/raid5-md1/aliases
  -1

is a bit suspicious.

And

void kmem_cache_destroy(struct kmem_cache *s)
{
	down_write(&slub_lock);
	if (s->refcount)
		s->refcount--;
	else {
		list_del(&s->list);
		WARN_ON(kmem_cache_close(s));
		sysfs_slab_remove(s);
		kfree(s);
	}
	up_write(&slub_lock);
}

looks a bit odd.
I would have thought the test should be:

        if (s->refcount > 1)

??

(2.6.21-rc6-mm1 to be precise)

NeilBrown

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

* Re: SLUB: kmem_cache_destroy doesn't
  2007-04-12  7:27 SLUB: kmem_cache_destroy doesn't Neil Brown
@ 2007-04-12 16:38 ` Christoph Lameter
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Lameter @ 2007-04-12 16:38 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-kernel

On Thu, 12 Apr 2007, Neil Brown wrote:

> And 
> 
>   # cat /sys/slab/raid5-md1/aliases
>   -1
> 
> is a bit suspicious.

Yuck!

> void kmem_cache_destroy(struct kmem_cache *s)
> {
> 	down_write(&slub_lock);
> 	if (s->refcount)
> 		s->refcount--;
> 	else {
> 		list_del(&s->list);
> 		WARN_ON(kmem_cache_close(s));
> 		sysfs_slab_remove(s);
> 		kfree(s);
> 	}
> 	up_write(&slub_lock);
> }
> 
> looks a bit odd.
> I would have thought the test should be:
> 
>         if (s->refcount > 1)

Correct. Does the change fix it?

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

end of thread, other threads:[~2007-04-12 16:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-12  7:27 SLUB: kmem_cache_destroy doesn't Neil Brown
2007-04-12 16:38 ` Christoph Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®