linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jeremy.linton@arm.com (Jeremy Linton)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 0/1] arm64: spinlocks: Fix write starvation with rwlock
Date: Tue,  3 Oct 2017 15:53:24 -0500	[thread overview]
Message-ID: <20171003205325.28703-1-jeremy.linton@arm.com> (raw)

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

             reply	other threads:[~2017-10-03 20:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03 20:53 Jeremy Linton [this message]
2017-10-03 20:53 ` [PATCH v2 1/1] arm64: spinlocks: Fix write starvation with rwlock Jeremy Linton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171003205325.28703-1-jeremy.linton@arm.com \
    --to=jeremy.linton@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).