Prev: schedule: simplify the reacquire_kernel_lock() logic
Next: mm: Move ARCH_SLAB_MINALIGN and ARCH_KMALLOC_MINALIGN to <linux/slab_def.h>
From: David Howells on 19 May 2010 09:30 Michel Lespinasse <walken(a)google.com> wrote: > +void __sched down_read_critical(struct rw_semaphore *sem) > +{ > + might_sleep(); > + rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_); > + > + LOCK_CONTENDED(sem, __down_read_trylock, __down_read_unfair); > + > + preempt_disable(); Shouldn't preemption really be disabled before __down_read_unfair() is called? Otherwise you can get an unfair read on a sem and immediately get taken off the CPU. Of course, this means __down_read_unfair() would have to deal with that in the slow path:-/ Oh, and something else that occurs to me: Do unfair readers have to go at the front of the wakeup queue? Can they be slightly less unfair and go either before the first reader in the queue or at the back of the queue instead? David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |