From 7a7c797c6fdc345a5a7e178f06f71174bd51ce39 Mon Sep 17 00:00:00 2001 From: Davidlohr Bueso Date: Thu, 22 May 2014 10:44:18 +1000 Subject: [PATCH] ipc,msg: document volatile r_msg The need for volatile is not obvious, document it. Signed-off-by: Davidlohr Bueso Signed-off-by: Manfred Spraul Cc: Aswin Chandramouleeswaran Signed-off-by: Andrew Morton --- ipc/msg.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ipc/msg.c b/ipc/msg.c index 6d33e30c7c39..c5d8e3749985 100644 --- a/ipc/msg.c +++ b/ipc/msg.c @@ -42,9 +42,7 @@ #include #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; }; -- 2.39.5