From: malte.vesper@postgrad.manchester.ac.uk (Malte Vesper)
To: kernelnewbies@lists.kernelnewbies.org
Subject: spinlock variable protection
Date: Fri, 30 Jan 2015 15:23:10 +0000 [thread overview]
Message-ID: <54CBA1DE.2040605@postgrad.manchester.ac.uk> (raw)
In-Reply-To: <CAJs94EZK6PAT6RbkuAvJgdNce_6WananEJ06NAC6vJirro1hMw@mail.gmail.com>
Spinlocks imply memory barriers as far as I am aware...
Read here:
http://lxr.free-electrons.com/source/Documentation/memory-barriers.txt#L1634
On 30/01/15 14:20, Matwey V. Kornilov wrote:
> 2015-01-30 16:52 GMT+03:00 buyitian <buyitian@gmail.com>:
>> Please check the assembly code to double confirm the GCC behavior.
>> Why will GCC change the order as what you mentioned? Only assembly code can tell you.
> It does not change at the moment. I think it can change it.
>
> Because from line
> ret = hdl->count;
> until line
> return ret;
> there is no access to either ret or hdl->count. So it is reasonable to
> optimizer to think that their values are the same and eliminate
> unneeded variable.
>
next prev parent reply other threads:[~2015-01-30 15:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-30 12:43 spinlock variable protection Matwey V. Kornilov
2015-01-30 13:52 ` buyitian
2015-01-30 14:20 ` Matwey V. Kornilov
2015-01-30 15:23 ` Malte Vesper [this message]
2015-01-30 15:29 ` Matwey V. Kornilov
2015-01-31 6:23 ` Arun KS
2015-01-31 12:04 ` Nicholas Mc Guire
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=54CBA1DE.2040605@postgrad.manchester.ac.uk \
--to=malte.vesper@postgrad.manchester.ac.uk \
--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).