Subject: Re: [PATCH] LSM networking: skb hooks for 2.5.42 (2/7)

From: Greg KH <[email-masked]>
Date: Tue, 15 Oct 2002 12:16:26 -0700

On Tue, Oct 15, 2002 at 02:14:01PM -0400, Donald Becker wrote:
>   - Your method adds a bunch of hooks when just one would do.

How would you propose a single hook?  Specify the action in the hook?
Linus has already rejected this idea :)

> The usual approach is
>    if (obj->hookfun)  obj->hookfun(obj, method_index, other_params);
> 
> Even this makes the code less readable, but at least doesn't jump all
> over the instruction space.  The impact is a dereference and a test for
> zero, and then a jump over a push/mov instructions for values that
> should already be in registers.

Linus has stated that he didn't want the check and then jump, but an
unconditional jump (even if the function is nothing but a return.)  I
guess this is faster as the processor doesn't have to guess at branch
prediction.  That's why we built these calls in this way.

That being said, a number of people have asked that the networking hooks
be able to "be compiled away", so we will be glad to do this.

thanks,

greg k-h