Skip to content

Commit

Permalink
ipc,msg: document volatile r_msg
Browse files Browse the repository at this point in the history
The need for volatile is not obvious, document it.

Signed-off-by: Davidlohr Bueso <[email protected]>
Signed-off-by: Manfred Spraul <[email protected]>
Cc: Aswin Chandramouleeswaran <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Davidlohr Bueso authored and torvalds committed Jun 6, 2014
1 parent 3440a6b commit 4bb6657
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ipc/msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
};

Expand Down

0 comments on commit 4bb6657

Please sign in to comment.