Re: [PATCH] locking/percpu_rwsem: Rewrite to not use rwsem

Oleg Nesterov
2019-10-30T14:21:34Z

On 10/29, Peter Zijlstra wrote:
>
> I like that symmetry, but see below ...

...

> > void __percpu_up_read(struct percpu_rw_semaphore *sem)
> > {
> > smp_mb();
> >
> > __this_cpu_dec(*sem->read_count);
> >
> preempt_enable();
> > wake_up(&sem->waiters);
> preempt_disable()
>
> and this (sadly) means there's a bunch of back-to-back
> preempt_disable()+preempt_enable() calls.

Hmm. Where did these enable+disable come from?

void __percpu_up_read(struct percpu_rw_semaphore *sem)
{
smp_mb();

__this_cpu_dec(*sem->read_count);

wake_up(&sem->waiters);
}

should work just fine?

Oleg.