[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.1210161924350.20581@file.rdu.redhat.com>
Date: Tue, 16 Oct 2012 19:30:49 -0400 (EDT)
From: Mikulas Patocka <mpatocka@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
cc: Jens Axboe <axboe@...nel.dk>, linux-kernel@...r.kernel.org
Subject: [PATCH] percpu-rwsem: use barrier in unlock path
Hi
When I read my patch 62ac665ff9fc07497ca524bd20d6a96893d11071 again, it
turns out that it is missing a barrier in percpu_up_write. Please apply
this.
Mikulas
---
percpu-rwsem: use barrier in unlock path
Fix missing barrier in patch 62ac665ff9fc07497ca524bd20d6a96893d11071.
The lock is considered unlocked when p->locked is set to false.
Use barrier prevent reordering of operations around p->locked.
Signed-off-by: Mikulas Patocka <mpatocka@...hat.com>
---
include/linux/percpu-rwsem.h | 9 +++++++++
1 file changed, 9 insertions(+)
Index: linux-3.6.2-fast/include/linux/percpu-rwsem.h
===================================================================
--- linux-3.6.2-fast.orig/include/linux/percpu-rwsem.h 2012-10-17 01:17:55.000000000 +0200
+++ linux-3.6.2-fast/include/linux/percpu-rwsem.h 2012-10-17 01:21:46.000000000 +0200
@@ -66,6 +66,15 @@ static inline void percpu_down_write(str
static inline void percpu_up_write(struct percpu_rw_semaphore *p)
{
+ /*
+ * The lock is considered unlocked when p->locked is set to false.
+ * Use barrier prevent reordering of operations around p->locked.
+ */
+#if defined(CONFIG_X86) && (!defined(CONFIG_X86_PPRO_FENCE) && !defined(CONFIG_X86_OOSTORE))
+ barrier();
+#else
+ smp_mb();
+#endif
p->locked = false;
mutex_unlock(&p->mtx);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists