[PATCH] volatile may be needed in rwsem

From: Joe Korty
Date: Tue Jan 27 2004 - 14:13:55 EST


'flags' should be declared volatile as rwsem_down_failed_common() spins
waiting for this to change. Untested.

Against 2.6.1.


diff -Nua 2.6/lib/rwsem-spinlock.c.0 2.6/lib/rwsem-spinlock.c
--- 2.6/lib/rwsem-spinlock.c.0 2004-01-27 14:03:46.000000000 -0500
+++ 2.6/lib/rwsem-spinlock.c 2004-01-27 14:03:38.000000000 -0500
@@ -12,7 +12,7 @@
struct rwsem_waiter {
struct list_head list;
struct task_struct *task;
- unsigned int flags;
+ volatile unsigned int flags;
#define RWSEM_WAITING_FOR_READ 0x00000001
#define RWSEM_WAITING_FOR_WRITE 0x00000002
};
diff -Nua 2.6/lib/rwsem.c.0 2.6/lib/rwsem.c
--- 2.6/lib/rwsem.c.0 2004-01-27 14:03:46.000000000 -0500
+++ 2.6/lib/rwsem.c 2004-01-27 14:03:19.000000000 -0500
@@ -10,7 +10,7 @@
struct rwsem_waiter {
struct list_head list;
struct task_struct *task;
- unsigned int flags;
+ volatile unsigned int flags;
#define RWSEM_WAITING_FOR_READ 0x00000001
#define RWSEM_WAITING_FOR_WRITE 0x00000002
};

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/