Re: 2.5.39 kmem_cache bug

Manfred Spraul (manfred@colorfullife.com)
Sat, 28 Sep 2002 23:12:54 +0200


Andrew Morton wrote:
> John Levon wrote:
>
>>kmem_cache_destroy() is falsely reporting
>>"kmem_cache_destroy: Can't free all objects" in 2.5.39. I have
>>verified my code was freeing all allocated items correctly.
>>
>>Reverting this chunk :
>>
>>- list_add(&slabp->list, &cachep->slabs_free);
>>+/* list_add(&slabp->list, &cachep->slabs_free); */
>>+ if (unlikely(list_empty(&cachep->slabs_partial)))
>>+ list_add(&slabp->list, &cachep->slabs_partial);
>>+ else
>>+ kmem_slab_destroy(cachep, slabp);
>>
>>and the problem goes away. I haven't investigated why.
>>
>
>
> Thanks. That's the code which leaves one empty page available
> for new allocations rather than freeing it immediately.
>
> It's temporary. Ed, I think we can just do
>
> if (list_empty(&cachep->slabs_free))
> list_add(&slabp->list, &cachep->slabs_free);
> else
> kmem_slab_destroy(cachep, slabp);
>
> there?

Look correct.
If you apply it, then reenable the BUG check in s_show() if a slab with
0 allocations is found on the partial list, too.

--
	Manfred

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/