[PATCH 0/2] fix and improvements for percpu-rw-semaphores (was:brw_mutex: big read-write mutex)
From: Mikulas Patocka
Date: Mon Oct 22 2012 - 19:36:51 EST
> > Ooooh. And I just noticed include/linux/percpu-rwsem.h which does
> > something similar. Certainly it was not in my tree when I started
> > this patch... percpu_down_write() doesn't allow multiple writers,
> > but the main problem it uses msleep(1). It should not, I think.
> >
> > But. It seems that percpu_up_write() is equally wrong? Doesn't
> > it need synchronize_rcu() before "p->locked = false" ?
> >
> > (add Mikulas)
>
> Mikulas said something about doing an updated patch, so I figured I
> would look at his next version.
>
> Thanx, Paul
The best ideas proposed in this thread are:
Using heavy/light barries by Lai Jiangshan. This fixes the missing barrier
bug, removes the ugly test "#if defined(X86) ..." and makes the read path
use no barrier instruction on all architectures.
Instead of rcu_read_lock, we can use rcu_read_lock_sched (or
preempt_disable) - the resulting code is smaller. The critical section is
so small that there is no problem disabling preemption.
I am sending these two patches. Linus, please apply them if there are no
objections.
Mikulas
--
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/