mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Ran Hongyun <ranhongyun1@huawei.com>, <namcao@linutronix.de>
Cc: <axboe@kernel.dk>, <bigeasy@linutronix.de>, <brauner@kernel.org>,
	<clrkwllms@kernel.org>, <frederic@kernel.org>, <jack@suse.cz>,
	<jdamato@fastly.com>, <john.ogness@linutronix.de>,
	<linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-rt-devel@lists.linux.dev>,
	<linux-rt-users@vger.kernel.org>, <mkarsten@uwaterloo.ca>,
	<rostedt@goodmis.org>, <stable@vger.kernel.org>,
	<torvalds@linux-foundation.org>, <viro@zeniv.linux.org.uk>,
	<vschneid@redhat.com>, <xry111@xry111.site>,
	<chengzhihao1@huawei.com>, <yangerkun@huawei.com>,
	<yi.zhang@huawei.com>, <wozizhi@huawei.com>
Subject: Re: [QUESTION] Are these issues PREEMPT_RT-specific?
Date: Fri, 4 Sep 2026 14:30:07 +0530	[thread overview]
Message-ID: <80432e77-2a51-43d8-82c6-5eff909f779b@amd.com> (raw)
In-Reply-To: <20260904081149.3000727-1-ranhongyun1@huawei.com>

Hello Ran,

On 9/4/2026 1:41 PM, Ran Hongyun wrote:
> The commit eb0d280c2751 ("eventpoll: Replace rwlock with spinlock") aims to fix:
> 
> 1.Priority inversion – On PREEMPT_RT, rwlock_t readers lack priority
> inheritance (PI), so a low-priority reader holding the lock can be
> preempted by a medium-priority task, blocking a high-priority writer
> indefinitely.
> 
> 2.Stall – A reader (p_read) holding the lock can be throttled by CFS
> bandwidth control and scheduled out. A writer (p_write) blocks waiting
> for the lock, and a timer thread (ktimers/n) needed to replenish p_read's
> runtime is blocked due to writer-fairness (286deb7ec03d). This forms a
> circular dependency and stalls the system.

This has been solved by putting off CFS bandwidth throttling until the
task exits to the userspace in
https://lore.kernel.org/lkml/20250829081120.806-1-ziqianlu@bytedance.com/
which landed in v6.18.

> Are these issues PREEMPT_RT-specific?

If you are running older version, stalls may be specific to PREEMPT_RT
since {read,write}_lock_irq* variants don't disable IRQs on PREEMPT_RT
and can tasks can get preempted (and throttled) in a rw_lock critical
section.

In addition to this, on PREEMPT_RT, a pending writer will make the future
readers wait until the writer is finished but there are optimizations on
!PREEMPT_RT that allows readers to jump ahead of a writer if concurrent
readers are present.

If a task takes a rw_lock and is trotthed in critical section and the
other end of that lock is later required by ktimers/n, the bandwidth
timer, which is also queued on ktimers/n will never run and allow for
unthrottling. Without untrottle, the first task never releases the lock.

Couple of reports from past are:

1. https://lore.kernel.org/linux-rt-users/xhsmhttqvnall.mognet@vschneid.remote.csb/
2. https://lore.kernel.org/all/7483d3ae-5846-4067-b9f7-390a614ba408@siemens.com/

There is a small breakdown of how 2. can lead to a stall here:

https://lore.kernel.org/all/e65a32af-271b-4de6-937a-1a1049bbf511@amd.com/

> Any clarification would be appreciated.

If you are running kernel version v6.18 or newer, the stalls from
bandwidth throttling shouldn't be an issue.

Priority inversion with rw_lock is still possible until we get
SCHED_PROXY_EXEC support and integrate it with PREEMPT_RT bits.

-- 
Thanks and Regards,
Prateek


  parent reply	other threads:[~2026-09-04  9:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-15 12:46 [PATCH v4 0/1] eventpoll: Fix priority inversion problem Nam Cao
2025-07-15 12:46 ` [PATCH v4 1/1] eventpoll: Replace rwlock with spinlock Nam Cao
2025-07-15 12:58   ` Nam Cao
2025-07-15 16:42   ` Linus Torvalds
2025-07-16  7:41     ` Nam Cao
2025-07-16  8:34   ` K Prateek Nayak
2025-08-26  8:43   ` Nam Cao
2025-09-03  8:40     ` Sebastian Andrzej Siewior
2025-09-05 13:52       ` Christian Brauner
2026-09-04  8:10   ` [QUESTION] Are these issues PREEMq:PT_RT-specific? Ran Hongyun
2026-09-04  8:11   ` [QUESTION] Are these issues PREEMPT_RT-specific? Ran Hongyun
2026-09-04  8:52     ` Florian Bezdeka
2026-09-04  9:00     ` K Prateek Nayak [this message]
2026-09-04 13:47     ` Steven Rostedt
2025-09-05 13:52 ` [PATCH v4 0/1] eventpoll: Fix priority inversion problem Christian Brauner

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=80432e77-2a51-43d8-82c6-5eff909f779b@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=axboe@kernel.dk \
    --cc=bigeasy@linutronix.de \
    --cc=brauner@kernel.org \
    --cc=chengzhihao1@huawei.com \
    --cc=clrkwllms@kernel.org \
    --cc=frederic@kernel.org \
    --cc=jack@suse.cz \
    --cc=jdamato@fastly.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mkarsten@uwaterloo.ca \
    --cc=namcao@linutronix.de \
    --cc=ranhongyun1@huawei.com \
    --cc=rostedt@goodmis.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=vschneid@redhat.com \
    --cc=wozizhi@huawei.com \
    --cc=xry111@xry111.site \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    /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®