From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Valdis.Kletnieks@vt.edu
Cc: Christoph Lameter <cl@linux-foundation.org>,
Pekka Enberg <penberg@cs.helsinki.fi>,
LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: mm: slab - __cache_alloc NULL prefetch fix
Date: Thu, 20 Nov 2008 23:10:22 +0300 [thread overview]
Message-ID: <20081120201022.GA5611@localhost> (raw)
In-Reply-To: <28180.1227211108@turing-police.cc.vt.edu>
[Valdis.Kletnieks@vt.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 -
prev parent reply other threads:[~2008-11-20 20:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-20 16:44 mm: slab - __cache_alloc NULL prefetch fix Cyrill Gorcunov
2008-11-20 17:01 ` Cyrill Gorcunov
2008-11-20 18:16 ` Christoph Lameter
2008-11-20 18:24 ` Cyrill Gorcunov
2008-11-20 18:15 ` Christoph Lameter
2008-11-20 19:58 ` Valdis.Kletnieks
2008-11-20 20:03 ` Pekka Enberg
2008-11-20 20:10 ` Cyrill Gorcunov [this message]
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=20081120201022.GA5611@localhost \
--to=gorcunov@gmail.com \
--cc=Valdis.Kletnieks@vt.edu \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
/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