On 01/05/2020 22.29, Peter Zijlstra wrote:
> Extend the static_call infrastructure to optimize the following common
> pattern:
> 
>       if (func_ptr)
>               func_ptr(args...)
> 
> +
>  #define static_call(name)    __static_call(name)
> +#define static_cond_call(name)       (void)__static_call(name)
>  
> +
>  #define static_call(name)    __static_call(name)
> +#define static_cond_call(name)       (void)__static_call(name)
>  

> +#define static_cond_call(name)                                               
> \
> +     if (STATIC_CALL_KEY(name).func)                                 \
> +             ((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func))
> +

This addresses neither the READ_ONCE issue nor the fact that, AFAICT,
the semantics of

  static_cond_call(foo)(i++)

will depend on CONFIG_HAVE_STATIC_CALL. Also, I'd have appreciated being
cc'ed on new revisions instead of stumbling on it by chance.

Rasmus

Reply via email to