lkml.org 
[lkml]   [2019]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] locking/percpu_rwsem: Rewrite to not use rwsem
On Wed, Oct 30, 2019 at 03:21:10PM +0100, Oleg Nesterov wrote:
> 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?

Not on PREEMPT_RT, because wake_up() will take wait_queue_head::lock,
which is spin_lock_t and turns into a pi_mutex, which we cannot take
with preemption disabled.

\
 
 \ /
  Last update: 2019-10-30 17:09    [W:0.087 / U:0.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site