lkml.org 
[lkml]   [2020]   [Dec]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH v2 10/19] dyndbg: avoid calling dyndbg_emit_prefix when it has no work
    Date
    Wrap function in a static-inline one, which checks flags to avoid
    calling the function unnecessarily.

    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    ---
    lib/dynamic_debug.c | 9 ++++++++-
    1 file changed, 8 insertions(+), 1 deletion(-)

    diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
    index 8e81ce58c1bd..daded73c8575 100644
    --- a/lib/dynamic_debug.c
    +++ b/lib/dynamic_debug.c
    @@ -612,7 +612,7 @@ static int remaining(int wrote)
    return 0;
    }

    -static char *dynamic_emit_prefix(const struct _ddebug *dp, char *buf)
    +static char *__dynamic_emit_prefix(const struct _ddebug *dp, char *buf)
    {
    int pos_after_tid;
    int pos = 0;
    @@ -652,6 +652,13 @@ static char *dynamic_emit_prefix(const struct _ddebug *dp, char *buf)
    return buf;
    }

    +static inline char *dynamic_emit_prefix(struct _ddebug *dp, char *buf)
    +{
    + if (unlikely(dp->flags & _DPRINTK_FLAGS_INCL_ANY))
    + return __dynamic_emit_prefix(dp, buf);
    + return buf;
    +}
    +
    void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
    {
    va_list args;
    --
    2.29.2
    \
     
     \ /
      Last update: 2020-12-25 21:23    [W:3.857 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site