linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/1] arm64: spinlocks: Fix write starvation with rwlock
@ 2017-10-03 20:53 Jeremy Linton
  2017-10-03 20:53 ` [PATCH v2 1/1] " Jeremy Linton
  0 siblings, 1 reply; 2+ messages in thread
From: Jeremy Linton @ 2017-10-03 20:53 UTC (permalink / raw)
  To: linux-arm-kernel

The ARM64 rwlock is unfair in that readers can perpetually
block the writer. This is most noticeable with tests like

`stress-ng --kill $SOMENUMBERLESSTHANCPUS -t $RUNTIME -v`

which can hold the task lock with fairly small counts
(say 4 on thunderx). This can in some circumstances result
in machine deadlocks as kernel tasks get blocked and the
machine gradually falls over.

This patch changes the rwlock behavior so that readers
not in_interrupt() wait for the writer to complete before
acquiring the lock.

Heavily tested on 1S thunderx, further testing the v8.3 fast
model (for LSE). With the thunderx machines the stress-ng
process counts can be larger than the number of cores on the
machine without causing interactivity problems previously seen
at much lower counts.

V1->V2:
  Added additional code to the arch_read_lock() case which
  allows the read lock to bypass a waiting writer when its
  in interrupt context.

Jeremy Linton (1):
  arm64: spinlocks: Fix write starvation with rwlock

 arch/arm64/include/asm/spinlock.h | 67 ++++++++++++++++++++++++++-------------
 1 file changed, 45 insertions(+), 22 deletions(-)

-- 
2.13.5

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-03 20:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-03 20:53 [PATCH v2 0/1] arm64: spinlocks: Fix write starvation with rwlock Jeremy Linton
2017-10-03 20:53 ` [PATCH v2 1/1] " Jeremy Linton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).