* [PATCH] Documentation: improvement to volatile considered harmful (resubmit)
@ 2007-07-01 12:26 Heikki Orsila
2007-07-02 14:59 ` Jonathan Corbet
0 siblings, 1 reply; 2+ messages in thread
From: Heikki Orsila @ 2007-07-01 12:26 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: corbet, rdunlap
I'm resubmitting this as I didn't get any replies, this time CCeing
proper people, sorry..
Kernel locking/synchronization primitives are better than volatile types
from code readability point of view also.
This patch is against 2.6.22-rc6.
Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
diff --git a/Documentation/volatile-considered-harmful.txt b/Documentation/volatile-considered-harmful.txt
index 10c2e41..ab9e62e 100644
--- a/Documentation/volatile-considered-harmful.txt
+++ b/Documentation/volatile-considered-harmful.txt
@@ -17,8 +17,9 @@ all optimization-related problems in a more efficient way.
Like volatile, the kernel primitives which make concurrent access to data
safe (spinlocks, mutexes, memory barriers, etc.) are designed to prevent
-unwanted optimization. If they are being used properly, there will be no
-need to use volatile as well. If volatile is still necessary, there is
+unwanted optimization. If they are being used properly, there will be no
+need to use volatile as well. Also, they make code more readable as they
+represent their intent explicitly. If volatile is still necessary, there is
almost certainly a bug in the code somewhere. In properly-written kernel
code, volatile can only serve to slow things down.
--
Heikki Orsila Barbie's law:
heikki.orsila@iki.fi "Math is hard, let's go shopping!"
http://www.iki.fi/shd
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Documentation: improvement to volatile considered harmful (resubmit)
2007-07-01 12:26 [PATCH] Documentation: improvement to volatile considered harmful (resubmit) Heikki Orsila
@ 2007-07-02 14:59 ` Jonathan Corbet
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Corbet @ 2007-07-02 14:59 UTC (permalink / raw)
To: Heikki Orsila; +Cc: linux-kernel, rdunlap
Heikki Orsila <shdl@zakalwe.fi> wrote:
> I'm resubmitting this as I didn't get any replies, this time CCeing
> proper people, sorry..
>
> Kernel locking/synchronization primitives are better than volatile types
> from code readability point of view also.
I think that just dilutes the real point. It's not a choice between
locking and volatile - the locking must be there regardless. It's a
correctness issue; if the result happens to be more readable too that's
a bonus.
If somebody wants to put this sentence in I won't object, but I don't
think it really improves the document either.
Thanks,
jon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-07-02 14:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-01 12:26 [PATCH] Documentation: improvement to volatile considered harmful (resubmit) Heikki Orsila
2007-07-02 14:59 ` Jonathan Corbet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox