Re: PATCH killing dead code and design errors in pre6

Andi Kleen (ak@muc.de)
13 Jan 1999 15:22:58 +0100


In article <369BD8A7.AE499CB8@cs.net.pl>,
dalecki@cs.net.pl (Marcin Dalecki) writes:
> Hello Everybody!
> The following simple patch is a correction of a design error
> in the slab implementation.

> Several YEARS ago it got introduced into the general linux kernel.
> It is providing a mechanism of constructors and destructors for the
> objects allocaed and deallocated. However still after YEARS I found
> actually only one place in the kernel where it was used!

> READ TWICE: Only one.

A) It was actually used twice during 2.1, but it got later removed by other
changes.

B) Using pre initialized headers for skbuffs gives an about 20% forwarding
rate improvement for fast routing.

C) Read Bonwick's original paper before doing any changes to slab.c.

> And there only the constructor was present and even the usage of it
> was bogous at least. (Please see the corresponding comment in the
> patch.)

You did not understand the basic idea behind slab: it is an object cache
that is able to cached _initialized_ objects, because for some objects
it is more expensive to initialize them than to use them in the fast path.
Skbuffs are exactly such an example. Moving the constructor into the caller
does not work, because the caller doesn't know if the object was freshly
allocated from the page allocator, or was from an already initialized object
cache. In the later case it does not need to initialize at all!

Linus, please don't apply this bogus patch.

Thank you,

-Andi

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