Re: [PATCH 09/10] Change table chaining layout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, 25 Oct 2007, Rusty Russell wrote:
> On Wednesday 24 October 2007 01:22:55 Linus Torvalds wrote:
> >
> > Well, I'd personally actually prefer to *not* have the count be passed
> > down explicitly, because it's just too error prone.
> 
> Well, the duplication is bad, but walking lists to find the length is
> inefficient so you pass around the length as well.

Nobody should *ever* walk the list to find the length. Does anybody really 
do that? Yes, we pass the thing down, but do people *need* it?

[ Side note: some of the users of that length currently would seem to be 
  buggy in the presense of continuation entries, and seem to assume that 
  the "list" is just a contiguous array. In fatc, that's almost the only 
  valid use for the "count" thing, since any other use _has_ to walk it 
  entry by entry anyway, no? ]

The thing is, nobody should care. You walk the list to fill things in, or 
to write it out to some HW-specific DMA table, you should never care about 
the length. However, you *do* care about the "where does it end" part: to 
be able to detect overflows (which should never happen, but from a 
debugging standpoint it needs to be detectable rather than just silently 
use or corrupt memory).

But if people really want/need the length, then we damn well should have a 
"header" thing, not two independent "list + length" parameters.

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux