[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190604091000.GH3402@hirez.programming.kicks-ass.net>
Date: Tue, 4 Jun 2019 11:10:00 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Waiman Long <longman@...hat.com>
Cc: Ingo Molnar <mingo@...hat.com>, Will Deacon <will.deacon@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org,
x86@...nel.org, Davidlohr Bueso <dave@...olabs.net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Tim Chen <tim.c.chen@...ux.intel.com>,
huang ying <huang.ying.caritas@...il.com>
Subject: Re: [PATCH v8 15/19] locking/rwsem: Adaptive disabling of reader
optimistic spinning
On Mon, May 20, 2019 at 04:59:14PM -0400, Waiman Long wrote:
> Reader optimistic spinning is helpful when the reader critical section
> is short and there aren't that many readers around. It makes readers
> relatively more preferred than writers. When a writer times out spinning
> on a reader-owned lock and set the nospinnable bits, there are two main
> reasons for that.
>
> 1) The reader critical section is long, perhaps the task sleeps after
> acquiring the read lock.
> 2) There are just too many readers contending the lock causing it to
> take a while to service all of them.
>
> In the former case, long reader critical section will impede the progress
> of writers which is usually more important for system performance.
> In the later case, reader optimistic spinning tends to make the reader
> groups that contain readers that acquire the lock together smaller
> leading to more of them. That may hurt performance in some cases. In
> other words, the setting of nonspinnable bits indicates that reader
> optimistic spinning may not be helpful for those workloads that cause it.
>
> Therefore, any writers that have observed the setting of the writer
> nonspinnable bit for a given rwsem after they fail to acquire the lock
> via optimistic spinning will set the reader nonspinnable bit once they
> acquire the write lock. Similarly, readers that observe the setting
> of reader nonspinnable bit at slowpath entry will also set the reader
> nonspinnable bit when they acquire the read lock via the wakeup path.
So both cases set the _reader_ nonspinnable bit?
Powered by blists - more mailing lists