> It's not being allocated at "compile time", it's being 
> allocated linearly into one block of ram in order to avoid 
> pointer derefs but it's still "dynamic" in that the size 
> isn't known until the alloc_netdev() call.
> 
> We do this trick all over the networking, TCP sockets are 3 
> or 4 different structures, all allocated into a linear block 
> of memory so that:
> 
> 1) only one memory allocation needs to be done for each object
>    create, this is not relevant for the net_device case
>    except in extreme examples bringing thousands of devices
>    up and down which I suppose someone can give a realistic
>    example of :-)
> 
> 2) each part can be accessed as an offset from the other instead
>    of a pointer deref which costs a cpu memory read
> 
> Please change the allocation strategy as I recommended, thanks.

Later this afternoon someone in my group came over and bonked me in the
head, and made this obvious to me.  Thanks for the follow-up; great
catch on the efficiency.  It's in my code now and is currently running
some test passes.

Thanks Dave,

-PJ Waskiewicz
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to