From: Jes S. <je...@sg...> - 2006-05-18 12:01:14
|
Alan Stern wrote: > On Wed, 17 May 2006, Jes Sorensen wrote: > >> If task_notifier_call_chain() etc. were inline'd we'd save one >> level of indirection without growing the code size given that these >> functions only continue calling into the next level of notifier >> functions. > > The way Matt did it is quite common; lots of other notifier chains in the > kernel work this way. Keeping those routines out-of-line rather than > in-line has two advantages: > > 1: It makes the kernel a little bit smaller, because each caller has > to submit only two arguments instead of three. (Of course, traded > off against this is the need to include the code for the > out-of-line routine itself. The more callers, the bigger the > advantage.) Hi Alan, In this case I think 1) is a wash, since it's a function call straight to another function call, only dereferencing a pointer once. The cost of the call by far outweighs it. > 2: It allows you to hide the underlying mechanism (the chain head) > and expose only an API. This simplifies later changes, such as > the move from an atomic chain to a blocking chain. The users have to be recompiled for any kernel update anyway so I don't feel this is applicable either. If someone finds it makes sense the register/unregister calls could be kept out-lined, but I think the call chain should be inlined for performance reasons. Cheers, Jes |