lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 5 Jan 2012 11:25:30 -0000
From:	"David Laight" <David.Laight@...LAB.COM>
To:	"Joe Perches" <joe@...ches.com>,
	"Larry Finger" <Larry.Finger@...inger.net>,
	"Chaoming Li" <chaoming_li@...lsil.com.cn>
Cc:	"John W. Linville" <linville@...driver.com>,
	<linux-wireless@...r.kernel.org>, <netdev@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 1/7] rtlwifi: Neaten RT_ASSERT, RT_TRACE, RTPRINT, RT_PRINT_DATA macros

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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ