mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Juri Lelli <juri.lelli@redhat.com>,
	Mike Stowell <mstowell@redhat.com>
Subject: Re: [PATCH v2] locking/rtmutex: Limit # of lock stealing for non-RT waiters
Date: Thu, 23 Jun 2022 10:41:17 -0400	[thread overview]
Message-ID: <be4db8af-7855-1f54-c2f2-947577b71f94@redhat.com> (raw)
In-Reply-To: <YrRriHsAdxPwEnWW@linutronix.de>


On 6/23/22 09:32, Sebastian Andrzej Siewior wrote:
> On 2022-06-21 15:36:41 [-0400], Waiman Long wrote:
>> Commit 48eb3f4fcfd3 ("locking/rtmutex: Implement equal priority lock
>> stealing") allows unlimited number of lock stealing's for non-RT
>> tasks. That can lead to lock starvation of non-RT top waiter tasks if
>> there is a constant incoming stream of non-RT lockers. This can cause
>> task lockup in PREEMPT_RT kernel. For example,
>>
>> [ 1249.921363] INFO: task systemd:2178 blocked for more than 622 seconds.
>> [ 1872.984225] INFO: task kworker/6:4:63401 blocked for more than 622 seconds.
>>
>> Avoiding this problem and ensuring forward progress by limiting the
>> number of times that a lock can be stolen from each waiter. This patch
>> sets a threshold of 10. That number is arbitrary and can be changed
>> if needed.
>>
>> With that change, the task lockups previously observed when running
>> stressful workloads on PREEMPT_RT kernel disappeared.
> Do you have more insight on how this was tested/ created? Based on that,
> systemd and a random kworker waited on a lock for more than 10 minutes.

The hang happens when our QE team run thier kernel tier 1 test which, I 
think, lasts several hours. The hang happens in some runs but not all of 
them. So it is kind of opportunistic. Mike should be able to provide a 
better idea about frequency and so on.

>
> I added a trace-printk each time a non-RT waiter got the lock stolen,
> kicked a kernel build and a package upgrade and took a look at the stats
> an hour later:
> - sh got its lock stolen 3416 times. I didn't lock the pid so I can't
>    look back and check how long it waited since the first time.
> - the median average of stolen locks is 173.
Maybe we should also more lock stealing per waiter than the 10 that I 
used in the patch. I am open to suggestion to what is a good value to use.
>
>> Fixes: 48eb3f4fcfd3 ("locking/rtmutex: Implement equal priority lock stealing")
>> Reported-by: Mike Stowell <mstowell@redhat.com>
>> Signed-off-by: Waiman Long <longman@redhat.com>

Thanks for your time looking at the patch.

Cheers,
Longman


  reply	other threads:[~2022-06-23 14:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21 19:36 Waiman Long
2022-06-21 19:38 ` Waiman Long
2022-06-23 13:32 ` Sebastian Andrzej Siewior
2022-06-23 14:41   ` Waiman Long [this message]
2022-06-24  6:42     ` Sebastian Andrzej Siewior
2022-06-25  2:23       ` Waiman Long

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=be4db8af-7855-1f54-c2f2-947577b71f94@redhat.com \
    --to=longman@redhat.com \
    --cc=bigeasy@linutronix.de \
    --cc=boqun.feng@gmail.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mstowell@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.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

all inboxes | Powered by JetHome®