From mboxrd@z Thu Jan 1 00:00:00 1970 From: matwey.kornilov@gmail.com (Matwey V. Kornilov) Date: Fri, 30 Jan 2015 19:29:37 +0400 Subject: spinlock variable protection In-Reply-To: <54CBA1DE.2040605@postgrad.manchester.ac.uk> References: <54CBA1DE.2040605@postgrad.manchester.ac.uk> Message-ID: To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org Nice, thank you 30.01.2015 18:24 ???????????? "Malte Vesper" < malte.vesper@postgrad.manchester.ac.uk> ???????: > 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 : >> >>> 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 part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150130/d9af5564/attachment.html