From: Tejun Heo <tj@kernel.org>
To: Liz Fong-Jones <lizf@honeycomb.io>
Cc: Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Jens Axboe <axboe@kernel.dk>,
Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Shakeel Butt <shakeel.butt@linux.dev>,
Xin Yin <yinxin.x@bytedance.com>,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
ian@honeycomb.io
Subject: Re: [PATCH v5 3/3] writeback: switch a replaced cgwb's inodes to its successor
Date: Fri, 02 Oct 2026 09:23:09 -1000 [thread overview]
Message-ID: <c5675dcba08c91acaddfc2869193cdb3@kernel.org> (raw)
In-Reply-To: <20261001-wb-dying-cgwb-flush-v5-3-8361eb8c65c6@honeycomb.io>
Hello, Liz.
On Thu, Oct 01, 2026 at 11:50:21PM +0000, Liz Fong-Jones wrote:
> it only queues the work, after dropping cgwb_lock. Inodes already being
> switched when the work runs are left to the existing per-inode
> switching, so this is best effort. If the successor is already gone,
That covers inodes being switched away from the old wb but not the ones
being switched to it. inode_switch_wbs() pins its target while the wb is
still live and the context lands later through the wb's switch_work, with
nothing ordering that against replaced_work. Those inodes end up on the
replaced wb after its scan, and for a removed memcg css_is_dying() keeps
them there until clean.
Every context lands through inode_switch_wbs_work_fn(), so can you kick
replaced_work from there when new_wb is dying and no longer owns its slot?
A dying wb that still owns its slot must not be kicked, or the work would
look up itself.
> + /*
> + * The replaced wb is out of foreign flushes' reach but may still have
> + * inodes attached, dirty or not. Switch them over to @wb. We may be
> + * running with interrupts disabled, so use a work item. A replaced wb
> + * never returns to the tree, so its work can't already be pending.
> + */
> + if (replaced_wb &&
> + !queue_work(system_dfl_wq, &replaced_wb->replaced_work))
> + wb_put(replaced_wb);
With the re-kick, already pending becomes a normal case. Maybe make this a
helper which trygets, queues and puts on failure, shared by both call
sites, and drop the last sentence.
Thanks.
--
tejun
prev parent reply other threads:[~2026-10-02 19:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 23:50 [PATCH v5 0/3] writeback: let foreign flushes reach dying cgwbs Liz Fong-Jones
2026-10-01 23:50 ` [PATCH v5 2/3] " Liz Fong-Jones
2026-10-02 19:21 ` Tejun Heo
2026-10-01 23:50 ` [PATCH v5 1/3] writeback: clear the old wb's dirty IO state after switching inodes Liz Fong-Jones
2026-10-02 19:21 ` Tejun Heo
2026-10-01 23:50 ` [PATCH v5 3/3] writeback: switch a replaced cgwb's inodes to its successor Liz Fong-Jones
2026-10-02 19:23 ` Tejun Heo [this message]
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=c5675dcba08c91acaddfc2869193cdb3@kernel.org \
--to=tj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=ian@honeycomb.io \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizf@honeycomb.io \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=viro@zeniv.linux.org.uk \
--cc=yinxin.x@bytedance.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®