lkml.org 
[lkml]   [2012]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: [PATCH 1/7] rtlwifi: Neaten RT_ASSERT, RT_TRACE, RTPRINT, RT_PRINT_DATA macros
Date
From
> +#define RT_PRINT_DATA(rtlpriv, _comp, _level, _titlestring, _hexdata,
\
> + _hexdatalen) \
> +do { \
> + if (unlikely(((_comp) & rtlpriv->dbg.global_debugcomponents) &&
\
> + (_level <= rtlpriv->dbg.global_debuglevel))) {
\
> + printk(KERN_DEBUG "%s: ", KBUILD_MODNAME); \
> + pr_cont("In process \"%s\" (pid %i):", \
> + current->comm, current->pid); \
> + printk(_titlestring); \
> + print_hex_dump_bytes("", DUMP_PREFIX_NONE, \
> + _hexdata, _hexdatalen);
\
> + }
\
> +} while (0)

From my experiences you need to use:
if (unlikely(a) && b)
not:
if (unlikely(a && b))
to get the expected static branch prediction.

Also, only the initial test need be in the #define,
the printfs (etc) can be moved into a real function.
This would reduce the code size (if used more than once).

David




\
 
 \ /
  Last update: 2012-01-05 12:29    [W:0.122 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site