Re: [RFC] timers, pointers to functions and type safety

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

 



Ingo Molnar <[email protected]> wrote:

> the question is: which is more important, the type safety of a 
> container_of() [or type cast], which if we get it wrong produces a 
> /very/ trivial crash that is trivial to fix - or embedded timers data 
> structure size all around the kernel? I believe the latter is more 
> important.

Indeed yes.

Using container_of() and ditching the data value, you generally have to have
one extra instruction per timer handler, if that, but you are able to discard
one instruction or more from __run_timers() and struct timer_list discards a
word.

You will almost certainly have far more timer_list structs in the kernel than
timer handler functions, therefore it's a space win, and possibly also a time
win (if the reduction of __run_timers() is greater than the increase in the
timer handler).

And that extra instruction in the timer handler is usually going to be an
addition or subtraction of a small immediate value - which may be zero (in
which case the insn is dropped) or which may be folded directly into memory
access instruction offsets.

David
-
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