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] [day] [month] [year] [list]
Date:	Sun, 24 Oct 2010 02:49:48 +0900
From:	Namhyung Kim <namhyung@...il.com>
To:	Al Viro <viro@...IV.linux.org.uk>
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs/buffer.c: change buffer_busy() to use logical-OR
 expression

2010-10-23 (토), 18:21 +0100, Al Viro:
> On Sun, Oct 24, 2010 at 02:06:15AM +0900, Namhyung Kim wrote:
> > Convert bitwise-OR operator to logical-OR in favor of short-circuit
> > evaluation. The end result would be same.
> 
> It'll cost _more_.
> 
> Think of it:
> 	v = atomic_read(...)
> 	w = bh->b_state
> 	w &= constant
> 	v |= w
> 	return v
> vs.
> 	v = atomic_read()
> 	branch to l if not equal to 0
> 	w = bh->b_state
> 	if w & constant is not 0, branch to l
> 	v = 0
> 	return v
> l:	v = 1
> 	return v
> 
> That short-circuit won't win anything here.

I see. It adds expensive branch insns. I just checked that patched code
generated longer code, Cool. But what if I exchange the order of
evaluation, check the bitmask before atomic_read()? Isn't it helpful
either?

Thanks.


-- 
Regards,
Namhyung Kim


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