On Sun, 28 Jul 2002, Adam J. Richter wrote:
> Although noting in 2.5.29 appears to use downgrade_write(),
> I assume that the facility was added because it is going to be used
> in the near future. So, I've added what I think is an implementation
> of __downgrade_write for lib/rwsem-spinlock.c. It is the same as
> __up_write, except that it sets sem->activity to 1.
IMO you have to add the patch below, otherwise you may wake up a writer.
> Since nothing
> uses it yet, I haven't tested it.
Same problem here.
bye, Roman
diff -u -p -r1.1.1.1 rwsem-spinlock.c
--- lib/rwsem-spinlock.c 21 Oct 2001 23:50:13 -0000 1.1.1.1
+++ lib/rwsem-spinlock.c 28 Jul 2002 18:04:08 -0000
@@ -59,7 +59,7 @@ static inline struct rw_semaphore *__rws
/* try to grant a single write lock if there's a writer at the front of the queue
* - we leave the 'waiting count' incremented to signify potential contention
*/
- if (waiter->flags & RWSEM_WAITING_FOR_WRITE) {
+ if (waiter->flags & RWSEM_WAITING_FOR_WRITE && !sem->activity) {
sem->activity = -1;
list_del(&waiter->list);
waiter->flags = 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/