From: Nick Piggin <nickpiggin@yahoo.com.au>
To: "Robert P. J. Day" <rpjday@mindspring.com>
Cc: Borislav Petkov <petkov@math.uni-muenster.de>,
David Rientjes <rientjes@cs.washington.edu>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched.c : correct comment for this_rq_lock() routine
Date: Wed, 01 Nov 2006 19:13:07 +1100 [thread overview]
Message-ID: <45485713.7070005@yahoo.com.au> (raw)
In-Reply-To: <Pine.LNX.4.64.0611010252460.28051@localhost.localdomain>
Robert P. J. Day wrote:
> On Wed, 1 Nov 2006, Nick Piggin wrote:
>
>
>>Robert P. J. Day wrote:
>>
>>
>>>example, i was just poking around the source for the various
>>>"atomic.h" files and noticed a couple possible cleanups:
>>>
>>> 1) make sure *everyone* uses "volatile" in the typedef struct (which
>>> i actually submitted recently)
>>>
>>
>>I don't see why. There is nothing in atomic (eg. atomic_read) that
>>says there must be a compiler barrier around the operation.
>>
>>Have you checked that the architecture implementation actually needs
>>the volatile where you've added it?
>
>
> as just one example, you can read in include/asm-alpha/atomic.h:
>
> /*
> * Counter is volatile to make sure gcc doesn't try to be clever
> * and move things around on us. We need to use _exactly_ the address
> * the user gave us, not some alias that contains the same information.
> */
asm-alpha has volatile.
>
> now it may be that *some* architectures don't specifically require a
> volatile counter but, AFAIK, it doesn't actually hurt if it isn't
> necessary. OTOH, if it isn't necessary *at all* for *any*
> architecture, then that storage class should be *removed* in its
> entirety.
Then given that architecture specific code is private to that architecture,
the logical conclusion is that if it isn't required by *an* architectures,
then it should be removed as well.
IOW, you can't assume that because one arch does something one way, that
another has the same restrictions.
> in any event, all this is is another example of what appears to be
> niggling and unnecessary differences between arch-specific header
> files that could easily be turned into a single, standard definition
> that would work for everyone with very little effort (and perhaps some
> day be included from a single generic header file to avoid all that
> duplication in the first place).
So if you want to do that, then I'd prefer that you instead go through all
arch headers and figure out where the volatile is needed, and why, and
document it.
For example FRV, at a glance, doesn't need volatile AFAIKS. Probably neither
do a lot of architectures, given that atomic_read/set/add/etc. need not
imply compiler or memory barriers (I think).
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
next prev parent reply other threads:[~2006-11-01 8:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-30 21:02 [PATCH] sched.c : correct comment for this_rq_lock() routine Robert P. J. Day
2006-10-30 21:08 ` David Rientjes
2006-10-30 21:34 ` Robert P. J. Day
2006-10-30 22:05 ` Björn Steinbrink
2006-10-31 15:30 ` Borislav Petkov
2006-10-31 18:11 ` Robert P. J. Day
2006-10-31 22:46 ` Nick Piggin
2006-11-01 8:01 ` Robert P. J. Day
2006-11-01 8:13 ` Nick Piggin [this message]
2006-11-01 12:27 ` Borislav Petkov
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=45485713.7070005@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=petkov@math.uni-muenster.de \
--cc=rientjes@cs.washington.edu \
--cc=rpjday@mindspring.com \
/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