From: mulyadi.santosa@gmail.com (Mulyadi Santosa)
To: kernelnewbies@lists.kernelnewbies.org
Subject: where is __memory_barrier in kernel ?
Date: Tue, 8 Mar 2011 13:29:23 +0700 [thread overview]
Message-ID: <AANLkTin7FCM2zF=3UNqquU7NzQ99peyo2uApY3ZT1UG1@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimb2OLQFRaxox8dgf7eV6sDX48sm9eKbAvgrwCa@mail.gmail.com>
On Sun, Mar 6, 2011 at 21:02, loody <miloody@gmail.com> wrote:
> hi all:
> I grep kernel source and found cpu_relax is defined as
> __memory_barrier(), which seems not defined in kernel source.
> At beginning I think it may be the gcc build-in functions, but I
> cannot find in the gcc document.
> Where and what is that used for?
Hi..
are you sure it's memory barrier? I check the source in lxr.linux.no
(2.6.37.3) and cpu_relax is expanded as 'rep' and 'nop' asm
instruction
but speaking about __memory_barrier(), I find it in
http://lxr.linux.no/#linux+v2.6.37.3/include/linux/compiler-intel.h#L19...meaning...(at
least for me), it's a macro specificly defined in Intel C compiler
(not gcc which we usually uses).
IMHO, it does the same as barrier everywhere....processor stop a while
and it make sure any memory operation (especially write) has been
done....
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
next prev parent reply other threads:[~2011-03-08 6:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-06 14:02 where is __memory_barrier in kernel ? loody
2011-03-06 14:38 ` Михаил Кринкин
2011-03-08 6:20 ` piyush moghe
2011-03-08 6:29 ` Mulyadi Santosa [this message]
2011-03-08 6:38 ` piyush moghe
2011-03-10 15:13 ` loody
2011-03-10 16:51 ` Mulyadi Santosa
2011-03-13 2:26 ` Jim Cromie
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='AANLkTin7FCM2zF=3UNqquU7NzQ99peyo2uApY3ZT1UG1@mail.gmail.com' \
--to=mulyadi.santosa@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).