[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180515124532.GA19429@redhat.com>
Date: Tue, 15 May 2018 14:45:32 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Waiman Long <longman@...hat.com>, Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Davidlohr Bueso <dave@...olabs.net>,
"Theodore Y. Ts'o" <tytso@....edu>,
Amir Goldstein <amir73il@...il.com>, Jan Kara <jack@...e.cz>
Subject: Re: [RFC PATCH v2 2/2] locking/percpu-rwsem: Mark rwsem as
non-spinnable in percpu_rwsem_release()
On 05/15, Peter Zijlstra wrote:
>
> > > Afaict the whole .owner=NULL thing in release already stops the spinners
> >
> > Not really, the new writer will spin in this case, afaics.
> >
> > But this is another problem and probably we do not care. The new writer is
> > almost impossible in this particular case, another freeze_super() should
> > notice frozen != SB_UNFROZEN and return EBUSY.
>
> rwsem_spin_on_owner() checks rwsem_owner_is_writer(), which does owner
> && owner != RWSEM_READER_OWNED, which will fail for !owner.
Yep. So rwsem_spin_on_owner() goes to "out:" and returns
!rwsem_owner_is_reader() == T.
IOW, afaics owner == NULL means "spin unconditionally", I guess this is for
the case when the new writer is going to do rwsem_set_owner() or up_write()
has already called rwsem_clear_owner() but didn't do up_write() yet.
Probably makes sense, but the code is not very clean,
> Or am I completely confused again?
Or me, I am not sure.
Oleg.
Powered by blists - more mailing lists