From: "Paul E. McKenney" <paulmck@kernel.org>
To: Tejun Heo <tj@kernel.org>
Cc: Josef Bacik <josef@toxicpanda.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Jan Kara <jack@suse.cz>,
Roman Gushchin <roman.gushchin@linux.dev>,
Dennis Zhou <dennis@kernel.org>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] writeback: report a Tasks-RCU quiescent state per cgwb drain pass
Date: Wed, 9 Sep 2026 13:12:58 -0700 [thread overview]
Message-ID: <d49bd6cd-0670-47ba-b8ef-e3e8c0d49830@paulmck-laptop> (raw)
In-Reply-To: <aqGv7R4LTmlrW6QI@slm.duckdns.org>
On Wed, Sep 09, 2026 at 09:13:49AM -1000, Tejun Heo wrote:
> Hello,
>
> On Wed, Sep 09, 2026 at 12:03:20PM -0700, Paul E. McKenney wrote:
> > > The patch looks fine but this overall seems fragile. cond_resched() was
> > > already marking "stuff that can take too long" but we need to use
> > > cond_resched_tasks_rcu_qs() if it can take *really* long. There gotta be a
> > > way to make this more maintainable. If always doing tasks_rcu_qs from
> > > cond_resched() is too expensive, can it be be gated behind something cheaper
> > > e.g. some tick based test?
> >
> > This is the business end of cond_resched_tasks_rcu_qs() in preemptible
> > kernels (in which cond_resched() is nothingness):
> >
> > # define rcu_tasks_classic_qs(t, preempt) \
> > do { \
> > if (!(preempt) && READ_ONCE((t)->rcu_tasks_holdout)) \
> > WRITE_ONCE((t)->rcu_tasks_holdout, false); \
> > } while (0)
> >
> > This is pretty lightweight. Adding a jiffies check would likely make
> > it more expensive.
> >
> > Or am I missing your point?
>
> I found the following thread for why there is a separate variant for
> cond_resched_tasks_rcu_qs():
>
> https://lkml.kernel.org/r/20180224151240.0d63a059@vmware.local.home
Well, that was nine years ago. ;-)
> The rationale was that it'd make cond_resched() expensive, so I assumed it
> was relatively heavy. If it already comes down to a single test, I'm not
> sure having a separate interface makes a lot of sense. There isn't some
> semantical difference between the two, right? Anything which takes long
> enough needs to do the tasks rcu qs, and that is what we mark with
> cond_resched().
And nine years later, I am still good with cond_resched() implying
cond_resched_tasks_rcu_qs().
The people wanting to get rid of cond_resched() might have a different
opinion, though.
Thanx, Paul
next prev parent reply other threads:[~2026-09-09 20:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 18:01 [PATCH] writeback: report a Tasks-RCU quiescent state per cgwb drain pass Josef Bacik
2026-09-09 18:13 ` sashiko-bot
2026-09-09 18:16 ` Tejun Heo
2026-09-09 19:03 ` Paul E. McKenney
2026-09-09 19:13 ` Tejun Heo
2026-09-09 20:12 ` Paul E. McKenney [this message]
2026-09-09 19:38 ` Josef Bacik
2026-09-09 20:13 ` Paul E. McKenney
2026-09-09 18:17 ` Roman Gushchin
2026-09-10 8:46 ` Jan Kara
2026-09-11 16:08 ` Lorenzo Stoakes (ARM)
2026-09-11 16:14 ` Lorenzo Stoakes (ARM)
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=d49bd6cd-0670-47ba-b8ef-e3e8c0d49830@paulmck-laptop \
--to=paulmck@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bpf@vger.kernel.org \
--cc=david@kernel.org \
--cc=dennis@kernel.org \
--cc=jack@suse.cz \
--cc=josef@toxicpanda.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=roman.gushchin@linux.dev \
--cc=rppt@kernel.org \
--cc=stable@vger.kernel.org \
--cc=surenb@google.com \
--cc=tj@kernel.org \
--cc=vbabka@kernel.org \
--cc=willy@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