mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Laight" <David.Laight@ACULAB.COM>
To: "Joe Perches" <joe@perches.com>,
	"Larry Finger" <Larry.Finger@lwfinger.net>,
	"Chaoming Li" <chaoming_li@realsil.com.cn>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	<linux-wireless@vger.kernel.org>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 1/7] rtlwifi: Neaten RT_ASSERT, RT_TRACE, RTPRINT, RT_PRINT_DATA macros
Date: Thu, 5 Jan 2012 11:25:30 -0000	[thread overview]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6D8AF30@saturn3.aculab.com> (raw)
In-Reply-To: <54d3f83c3e53d7008a013a631c23360a983695a6.1325734202.git.joe@perches.com>

> +#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



  reply	other threads:[~2012-01-05 11:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05  3:40 [PATCH 0/7] rtlwifi: debug macros and uses neatening Joe Perches
2012-01-05  3:40 ` [PATCH 1/7] rtlwifi: Neaten RT_ASSERT, RT_TRACE, RTPRINT, RT_PRINT_DATA macros Joe Perches
2012-01-05 11:25   ` David Laight [this message]
2012-01-05  3:40 ` [PATCH 2/7] rtlwifi: Standardize RT_PRINT_DATA macro and uses Joe Perches
2012-01-05 11:43   ` Stanislaw Gruszka
2012-01-05 15:54     ` Larry Finger
2012-01-05 16:29     ` Joe Perches
2012-01-05 16:44       ` Larry Finger
2012-01-05 16:54         ` Joe Perches
2012-01-05  3:40 ` [PATCH 3/7] rtlwifi: Convert RT_TRACE macro to use ##__VA_ARGS__ Joe Perches
2012-01-05  3:40 ` [PATCH 4/7] rtlwifi: Convert RTPRINT " Joe Perches
2012-01-05  3:40 ` [PATCH 5/7] rtlwifi: Convert RT_ASSERT " Joe Perches
2012-01-05  3:40 ` [PATCH 6/7] rtlwifi: Remove duplicate __func__ Joe Perches
2012-01-05  3:40 ` [PATCH 7/7] rtlwifi: Optimize RT_TRACE macro use of KBUILD_MODNAME for size Joe Perches
2012-01-05 19:03 ` [PATCH 0/7] rtlwifi: debug macros and uses neatening Larry Finger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AE90C24D6B3A694183C094C60CF0A2F6D8AF30@saturn3.aculab.com \
    --to=david.laight@aculab.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=chaoming_li@realsil.com.cn \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®