[lkml]   [2020]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RESEND][PATCH v3 14/17] static_call: Add static_cond_call()

> On Mar 24, 2020, at 9:14 AM, Linus Torvalds <> wrote:
> On Tue, Mar 24, 2020 at 7:25 AM Peter Zijlstra <> wrote:
>> Extend the static_call infrastructure to optimize the following common
>> pattern:
>> if (func_ptr)
>> func_ptr(args...)
> Is there any reason why this shouldn't be the default static call pattern?
> IOW, do we need the special "cond" versions at all? Couldn't we just
> say that this is how static calls fundamentally work - if the function
> is NULL, they are nops?

I haven’t checked if static calls currently support return values, but the conditional case only makes sense for functions that return void.

Aside from that, it might be nice for passing NULL in to warn or bug when the NULL pointer is stored instead of silently NOPping out the call in cases where having a real implementation isn’t optional.
 \ /
  Last update: 2020-03-24 17:22    [W:0.062 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site