]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ipc,msg: document volatile r_msg
authorDavidlohr Bueso <davidlohr@hp.com>
Fri, 6 Jun 2014 21:37:46 +0000 (14:37 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Jun 2014 23:08:15 +0000 (16:08 -0700)
The need for volatile is not obvious, document it.

Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Cc: Aswin Chandramouleeswaran <aswin@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ipc/msg.c

index 6d33e30c7c393091a4374e8ed26a13240ffbaa25..c5d8e3749985be98b17c7bb1183dafb41332ea36 100644 (file)
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -42,9 +42,7 @@
 #include <linux/uaccess.h>
 #include "util.h"
 
-/*
- * one msg_receiver structure for each sleeping receiver:
- */
+/* one msg_receiver structure for each sleeping receiver */
 struct msg_receiver {
        struct list_head        r_list;
        struct task_struct      *r_tsk;
@@ -53,6 +51,12 @@ struct msg_receiver {
        long                    r_msgtype;
        long                    r_maxsize;
 
+       /*
+        * Mark r_msg volatile so that the compiler
+        * does not try to get smart and optimize
+        * it. We rely on this for the lockless
+        * receive algorithm.
+        */
        struct msg_msg          *volatile r_msg;
 };