Re: [PATCH] ATA over Ethernet driver for 2.6.9

From: Greg KH
Date: Thu Dec 09 2004 - 11:46:56 EST


On Thu, Dec 09, 2004 at 10:57:05AM -0500, Ed L Cashin wrote:
> Greg KH <greg@xxxxxxxxx> writes:
>
> ...
> >> +typedef struct Bufq Bufq;
> >> +struct Bufq {
> >> + Buf *head, *tail;
> >> +};
> >
> > What's wrong with the in-kernel list structures that you need to create
> > your own?
>
> The Buf structures are singly linked (one next pointer). We could
> convert it to use list.h, but that would mean having another pointer
> per list element.

Is the extra overhead of another pointer worth the effort of ensuring
that your list handling code is correct in all cases? (hint, the answer
is usually no...)

The in-kernel list code is very well debugged, and does lots of extra
cpu lookup goodness if it can, ensuring that it is as fast as it
possibly can be. It's also much better to rely on in-kernel
datastructures as programmers can instantly recognize that you are using
that, and not have to worry about exactly how you call your own custom
list code, and if your list code is even correct in the first place.

So in short, unless this is a structure that is in dire need of a memory
savings, I really suggest you use the in-kernel stuff.

thanks,

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