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]
Message-ID: <20081120201022.GA5611@localhost>
Date:	Thu, 20 Nov 2008 23:10:22 +0300
From:	Cyrill Gorcunov <gorcunov@...il.com>
To:	Valdis.Kletnieks@...edu
Cc:	Christoph Lameter <cl@...ux-foundation.org>,
	Pekka Enberg <penberg@...helsinki.fi>,
	LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: mm: slab - __cache_alloc NULL prefetch fix

[Valdis.Kletnieks@...edu - Thu, Nov 20, 2008 at 02:58:28PM -0500]
| On Thu, 20 Nov 2008 19:44:00 +0300, Cyrill Gorcunov said:
| 
| > -	prefetchw(objp);
| >  
| > -	if (likely(objp))
| > +	if (likely(objp)) {
| > +		prefetchw(objp);
| >  		kmemcheck_slab_alloc(cachep, flags, objp, obj_size(cachep));
| > +	}
| 
| Although it probably makes sense to not bother prefetching NULL, I also
| need to wonder how useful it is to prefetch something that we then
| turn around and dereference in the very next line of code.
| 
| Maybe we should just lose the prefetch entirely?

In case of obj == NULL it would not be a really penalty.
I heard there was a problem passing NULL to prefetch on
some PPC machines but PPC code already well protected
against it. So in most cases obj would not be null and
hint cpu that we will use this obj soon is good choise
I think. In case of kmemcheck it's true if only kmemcheck
was turned on, otherwise this if(obj) with empty kmemcheck_slab_alloc
body will be eliminated by compiler but in case of having there
(inside of 'if' block) prefetchw(objp) I'm not sure what gcc
will decide :-) Anyway -- it was a false alram from me since
having prefetch in original place is not problem. And maybe
modern cpus even have a special trap for NULL prefetch
target and eliminate it out on decoding stage without penalty
(just a guess).

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