From: Jan Kara <jack@suse.cz>
To: Roman Gushchin <guro@fb.com>
Cc: Jan Kara <jack@suse.cz>, Tejun Heo <tj@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Alexander Viro <viro@zeniv.linux.org.uk>,
Dennis Zhou <dennis@kernel.org>,
Dave Chinner <dchinner@redhat.com>,
cgroups@vger.kernel.org
Subject: Re: [PATCH v6 4/5] writeback, cgroup: support switching multiple inodes at once
Date: Thu, 3 Jun 2021 12:10:57 +0200 [thread overview]
Message-ID: <20210603101057.GH23647@quack2.suse.cz> (raw)
In-Reply-To: <20210603005517.1403689-5-guro@fb.com>
On Wed 02-06-21 17:55:16, Roman Gushchin wrote:
> Currently only a single inode can be switched to another writeback
> structure at once. That means to switch an inode a separate
> inode_switch_wbs_context structure must be allocated, and a separate
> rcu callback and work must be scheduled.
>
> It's fine for the existing ad-hoc switching, which is not happening
> that often, but sub-optimal for massive switching required in order to
> release a writeback structure. To prepare for it, let's add a support
> for switching multiple inodes at once.
>
> Instead of containing a single inode pointer, inode_switch_wbs_context
> will contain a NULL-terminated array of inode
> pointers. inode_do_switch_wbs() will be called for each inode.
>
> Signed-off-by: Roman Gushchin <guro@fb.com>
Two small comments below:
> @@ -473,10 +473,14 @@ static void inode_switch_wbs_work_fn(struct work_struct *work)
> {
> struct inode_switch_wbs_context *isw =
> container_of(to_rcu_work(work), struct inode_switch_wbs_context, work);
> + struct inode **inodep;
> +
> + for (inodep = &isw->inodes[0]; *inodep; inodep++) {
^^^^ why not just isw->inodes?
> + inode_do_switch_wbs(*inodep, isw->new_wb);
> + iput(*inodep);
> + }
I was kind of hoping that we would save the repeated locking of
bdi->wb_switch_rwsem, old_wb->list_lock, and new_wb->list_lock for multiple
inodes. Maybe we can have 'old_wb' as part of isw as well and assert that
all inodes are still attached to the old_wb at this point to make this a
bit simpler. Or we can fetch old_wb from the first inode and then just
lock & assert using that one.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2021-06-03 10:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-03 0:55 [PATCH v6 0/5] cgroup, blkcg: prevent dirty inodes to pin dying memory cgroups Roman Gushchin
2021-06-03 0:55 ` [PATCH v6 1/5] writeback, cgroup: switch to rcu_work API in inode_switch_wbs() Roman Gushchin
2021-06-03 8:46 ` Jan Kara
2021-06-03 0:55 ` [PATCH v6 2/5] writeback, cgroup: keep list of inodes attached to bdi_writeback Roman Gushchin
2021-06-03 8:55 ` Jan Kara
2021-06-03 0:55 ` [PATCH v6 3/5] writeback, cgroup: split out the functional part of inode_switch_wbs_work_fn() Roman Gushchin
2021-06-03 8:57 ` Jan Kara
2021-06-03 0:55 ` [PATCH v6 4/5] writeback, cgroup: support switching multiple inodes at once Roman Gushchin
2021-06-03 10:10 ` Jan Kara [this message]
2021-06-03 0:55 ` [PATCH v6 5/5] writeback, cgroup: release dying cgwbs by switching attached inodes Roman Gushchin
2021-06-03 10:02 ` Jan Kara
2021-06-04 1:36 ` Roman Gushchin
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=20210603101057.GH23647@quack2.suse.cz \
--to=jack@suse.cz \
--cc=cgroups@vger.kernel.org \
--cc=dchinner@redhat.com \
--cc=dennis@kernel.org \
--cc=guro@fb.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).