Add _INCL_LOOKUP condition to separate +mfsl flags from +t, allowing (after refactoring) to avoid a needless call-return.
Add a PREFIX_CACHED bit to remember that a pr-debug callsite is: - enabled, with +p - wants a dynamic-prefix, with _INCL_LOOKUP - was previously called - was thus saved in the prefix cache. NOT YET. This allows (later) to cache part/all of the dynamic-prefix for each pr_debug that gets called. NOTES: dyndbg's dynamic prefixing can get expensive; each enabled callsite's prefix is sprintf'd into stack-mem, every time a pr_debug is called. A cache would help, if callsites mark _DPRINTK_FLAGS_PREFIX_CACHED after saving the prefix string. But not yet. -t thread-id. not part of the "callsite" info, derived from current. doesn't belong in the cache. it would be wrong. can be done in outer: dynamic_emit_prefix() -mfsl module, function, source-file, line we cache these, composed into a sub-string. they are "lookups", currently to descriptor fields,. could be accessor macros to "compressed" tables. All enabled together, they compose a prefix string like: # outer -----inner------------------- "[tid] module:function:sourcfile:line: " So this patch extracts _DPRINTK_FLAGS_INCL_LOOKUP macro out of _DPRINTK_FLAGS_INCL_ANY macro, then redefs latter. Next re-refactor dynamic_emit_prefix inner/outer fns accordingly. Signed-off-by: Jim Cromie <jim.cro...@gmail.com> --- include/linux/dynamic_debug.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index c388ab05a6e1..82eabaa6e827 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -38,11 +38,13 @@ struct _ddebug { #define _DPRINTK_FLAGS_INCL_LINENO (1<<3) #define _DPRINTK_FLAGS_INCL_TID (1<<4) #define _DPRINTK_FLAGS_INCL_SOURCENAME (1<<5) +#define _DPRINTK_FLAGS_PREFIX_CACHED (1<<7) -#define _DPRINTK_FLAGS_INCL_ANY \ - (_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME |\ - _DPRINTK_FLAGS_INCL_LINENO | _DPRINTK_FLAGS_INCL_TID |\ - _DPRINTK_FLAGS_INCL_SOURCENAME) +#define _DPRINTK_FLAGS_INCL_LOOKUP \ + (_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME | \ + _DPRINTK_FLAGS_INCL_SOURCENAME | _DPRINTK_FLAGS_INCL_LINENO) +#define _DPRINTK_FLAGS_INCL_ANY \ + (_DPRINTK_FLAGS_INCL_TID | _DPRINTK_FLAGS_INCL_LOOKUP) #if defined DEBUG #define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT -- 2.49.0