linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Davide Libenzi <davidel@xmailserver.org>
To: Jonathan Lundell <jlundell@pobox.com>
Cc: Jan Hubicka <jh@suse.cz>,
	linux-kernel@vger.kernel.org,
	user-mode-linux-user@lists.sourceforge.net,
	Jeff Dike <jdike@karaya.com>, Andrea Arcangeli <andrea@suse.de>,
	Linus Torvalds <torvalds@transmeta.com>
Subject: Re: user-mode port 0.44-2.4.7
Date: Tue, 24 Jul 2001 08:41:34 -0700 (PDT)	[thread overview]
Message-ID: <XFMail.20010724084134.davidel@xmailserver.org> (raw)
In-Reply-To: <p05100306b7829ca20739@[10.0.0.49]>


On 24-Jul-2001 Jonathan Lundell wrote:
> At 3:51 PM -0700 2001-07-23, Linus Torvalds wrote:
>>On Mon, 23 Jul 2001, Jonathan Lundell wrote:
>>>
>>>  If jiffies were not volatile, this initializing assignment and the
>>>  test at the end could be optimized away, leaving an unconditional
>>>  "return 0". A lock is of no help.
>>
>>Right.
>>
>>We want optimization barriers, and there's an explicit "barrier()"  thing
>>for Linux exactly for this reason.
>>
>>For historical reasons "jiffies" is actually marked volatile, but at least
>>it has reasonably good semantics with a single-data item. Which is not to
>>say I like it. But grep for "barrier()" to see how many times we make this
>>explicit in the algorithms.
>>
>>And really, THAT is my whole point. Notice in the previous mail how I used
>>"volatile" when it was part of the _algorithm_. You should not hide
>>algorithmic choices in your data structures. You should make them
>>explicit, so that when you read the code you _see_ what assumptions people
>>make.
> 
> OK, sure, that's fine. Better than barrier() in some respects, too. 
> Namely, 1) volatile is portable C; barrier() isn't (not that that's 
> much of an issue for compiling Linux), and 2) volatile can be 
> specific to a variable, unlike the indiscriminate barrier(), which 
> forces a reload of everything that might be cached (OK, not a big 
> deal for IA32, but nontrivial for many-register architectures). One 
> could imagine a more specific barrier(jiffies) syntax, I suppose, but 
> the volatile cast is nice, restricting the effect not only to the 
> single variable but to the single reference to a single variable.

One more thing, with volatile you specify it one time ( declaration time ),
while with barrier() you've to spread inside the code tons of such macro
everywhere you touch the variable.



- Davide


  reply	other threads:[~2001-07-24 15:38 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-23  5:08 user-mode port 0.44-2.4.7 Jeff Dike
2001-07-23 15:56 ` Andrea Arcangeli
2001-07-23 15:59   ` Andrea Arcangeli
2001-07-23 16:17     ` Andrea Arcangeli
2001-07-23 16:51       ` Andrea Arcangeli
2001-07-23 16:33   ` Linus Torvalds
2001-07-23 16:45     ` Andrea Arcangeli
2001-07-23 17:32       ` Linus Torvalds
2001-07-23 17:50         ` Andrea Arcangeli
2001-07-23 18:11           ` Linus Torvalds
2001-07-23 18:27             ` Andrea Arcangeli
2001-07-23 20:00               ` Linus Torvalds
2001-07-23 20:15                 ` Jonathan Lundell
2001-07-23 22:51                   ` Linus Torvalds
2001-07-24  3:45                     ` Jonathan Lundell
2001-07-24 15:41                       ` Davide Libenzi [this message]
2001-07-24 15:46                         ` Alexander Viro
2001-07-24 16:01                           ` Davide Libenzi
2001-07-24 16:08                             ` Alexander Viro
2001-07-24 16:52                               ` Davide Libenzi
2001-07-24 16:59                                 ` Linus Torvalds
2001-07-24 17:31                                   ` Davide Libenzi
2001-07-24 17:38                                     ` Linus Torvalds
2001-07-24 18:07                               ` Anton Altaparmakov
2001-07-23 20:44                 ` Chris Friesen
2001-07-23 21:11                   ` Andrea Arcangeli
2001-07-23 21:50                   ` Richard Gooch
2001-07-23 22:09                     ` Andrea Arcangeli
2001-07-23 13:20                       ` Rob Landley
2001-07-23 22:27                         ` Andrea Arcangeli
2001-07-23 17:50                           ` Rob Landley
2001-07-23 23:47                     ` Richard Gooch
2001-07-24  0:04                       ` Andrea Arcangeli
2001-07-24  9:02                         ` Jan Hubicka
2001-07-24 15:35                           ` Linus Torvalds
2001-07-24 16:04                         ` Linus Torvalds
2001-07-25 22:49                           ` Andrea Arcangeli
2001-07-25 23:16                             ` Linus Torvalds
2001-07-25 23:37                               ` Chris Friesen
2001-07-26 18:28                             ` Jan Hubicka
2001-07-26 18:35                               ` Alan Cox
2001-07-23 22:53                   ` Linus Torvalds
2001-07-23 23:13                     ` Alan Cox
2001-07-23 20:25   ` Jeff Dike
     [not found] <no.id>
2001-07-23 20:57 ` Alan Cox
2001-07-23 21:14   ` Chris Friesen
2001-07-25 19:12 ` Alan Cox
2001-07-25 23:49 ` Alan Cox
2001-07-25 19:03 James W. Lake

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=XFMail.20010724084134.davidel@xmailserver.org \
    --to=davidel@xmailserver.org \
    --cc=andrea@suse.de \
    --cc=jdike@karaya.com \
    --cc=jh@suse.cz \
    --cc=jlundell@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    --cc=user-mode-linux-user@lists.sourceforge.net \
    /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).