From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: ThangNN99 <ngocthang2710.1999@gmail.com>,
Vlastimil Babka <vbabka@kernel.org>
Cc: Harry Yoo <harry@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Clark Williams <clrkwllms@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>, Hao Li <hao.li@linux.dev>,
Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-rt-devel@lists.linux.dev,
syzbot+acf142088e0182172e58@syzkaller.appspotmail.com
Subject: Re: [PATCH v3] mm/slab: don't use kfree_rcu sheaves on PREEMPT_RT in kvfree_call_rcu()
Date: Mon, 31 Aug 2026 16:35:00 +0200 [thread overview]
Message-ID: <20260831143500.x-saxdAs@linutronix.de> (raw)
In-Reply-To: <20260831133222.8637-1-ngocthang2710.1999@gmail.com>
On 2026-08-31 20:32:22 [+0700], ThangNN99 wrote:
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -2034,7 +2027,14 @@ void kvfree_call_rcu(struct kvfree_rcu_head *head, void *ptr)
> if (!head)
> might_sleep();
>
> - if (kfree_rcu_sheaf(ptr))
> + /*
> + * Callers may hold a raw_spinlock_t here on PREEMPT_RT (e.g.
> + * set_cpus_allowed_force(), whose callers all hold
> + * task_struct::pi_lock), and the sheaf/barn locks are also taken
> + * as blocking locks elsewhere, so trying them here creates a
> + * lockdep-visible ordering conflict. Skip sheaves on PREEMPT_RT.
> + */
You mix up things. A raw_spinlock_t should work in general and should
not cause a problem. The task_struct::pi_lock is special: It used during
wakes and the inner waitlock of the rtmutex acquires it even during a
trylock. For PREEMPT_RT we don't want to acquire any locks while the
pi_lock is held.
What about
kvfree_rcu() is called by set_cpus_allowed_force() with
task_struct::pi_lock acquired. On PREEMPT_RT the local_trylock()
usage below will acquire the waitlock which must be avoided.
Therefore avoid it on PREEMPT_RT.
Vlastimil?
> + if (!IS_ENABLED(CONFIG_PREEMPT_RT) && kfree_rcu_sheaf(ptr))
> return;
>
> // Queue the object but don't yet schedule the batch.
Sebastian
next prev parent reply other threads:[~2026-08-31 14:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 5:38 [PATCH] " ThangNN99
2026-08-31 5:50 ` sashiko-bot
2026-08-31 6:06 ` [PATCH v2] " ThangNN99
2026-08-31 6:20 ` sashiko-bot
2026-08-31 6:33 ` ThangNN99
2026-08-31 13:00 ` Sebastian Andrzej Siewior
2026-08-31 13:32 ` [PATCH v3] " ThangNN99
2026-08-31 13:51 ` sashiko-bot
2026-08-31 13:55 ` ThangNN99
2026-08-31 14:35 ` Sebastian Andrzej Siewior [this message]
2026-08-31 16:04 ` Vlastimil Babka (SUSE)
2026-08-31 16:17 ` [PATCH] mm/slab: don't use kfree_rcu_sheaf() on PREEMPT_RT again ThangNN99
2026-09-02 10:05 ` [PATCH v3] mm/slab: don't use kfree_rcu sheaves on PREEMPT_RT in kvfree_call_rcu() Harry Yoo
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=20260831143500.x-saxdAs@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=clrkwllms@kernel.org \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=ngocthang2710.1999@gmail.com \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=rostedt@goodmis.org \
--cc=syzbot+acf142088e0182172e58@syzkaller.appspotmail.com \
--cc=vbabka@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®