Inlined functions in network code
From: Mulyadi Santosa <hidden>
Date: 2012-03-09 19:02:45
Hi :) On Sat, Mar 10, 2012 at 01:41, ?ukasz Czy? [off-list ref] wrote:
Hello I implemented stateful IPv6-IPv4 NAT translator which works on top of netfilter. It is fully functional now,
congratulations! A nice achievement IMHO.... :) is it merged with linux kernel mainline?
I only have a doubt about criterion when to declare function as inline. Should all functions which are used during packet translation (so they may be called very frequently) be inlined?
perhaps network guys know better, but I think inlining as we all know, prevent code path to do jumps. And that will code execution faster, especially when it happen many many times (read: millions or more). And likely they will stay at the same L1 i-cache or at least nearby...so that's nice too :) IIRC too, "jmp" will screw branch prediction and sometimes will make pipeline stall.....So, all in all, it's a matter about speeding about code path, especially fast path like what you do. -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com