[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210603085533.GE23647@quack2.suse.cz>
Date: Thu, 3 Jun 2021 10:55:33 +0200
From: Jan Kara <jack@...e.cz>
To: Roman Gushchin <guro@...com>
Cc: Jan Kara <jack@...e.cz>, Tejun Heo <tj@...nel.org>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Alexander Viro <viro@...iv.linux.org.uk>,
Dennis Zhou <dennis@...nel.org>,
Dave Chinner <dchinner@...hat.com>, cgroups@...r.kernel.org
Subject: Re: [PATCH v6 2/5] writeback, cgroup: keep list of inodes attached
to bdi_writeback
On Wed 02-06-21 17:55:14, Roman Gushchin wrote:
> Currently there is no way to iterate over inodes attached to a
> specific cgwb structure. It limits the ability to efficiently
> reclaim the writeback structure itself and associated memory and
> block cgroup structures without scanning all inodes belonging to a sb,
> which can be prohibitively expensive.
>
> While dirty/in-active-writeback an inode belongs to one of the
> bdi_writeback's io lists: b_dirty, b_io, b_more_io and b_dirty_time.
> Once cleaned up, it's removed from all io lists. So the
> inode->i_io_list can be reused to maintain the list of inodes,
> attached to a bdi_writeback structure.
>
> This patch introduces a new wb->b_attached list, which contains all
> inodes which were dirty at least once and are attached to the given
> cgwb. Inodes attached to the root bdi_writeback structures are never
> placed on such list. The following patch will use this list to try to
> release cgwbs structures more efficiently.
>
> Suggested-by: Jan Kara <jack@...e.cz>
> Signed-off-by: Roman Gushchin <guro@...com>
Looks good, just one small comment below, with that fixed feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
...
> @@ -1014,6 +1024,12 @@ fs_initcall(cgroup_writeback_init);
> static void bdi_down_write_wb_switch_rwsem(struct backing_dev_info *bdi) { }
> static void bdi_up_write_wb_switch_rwsem(struct backing_dev_info *bdi) { }
>
> +static void inode_cgwb_move_to_attached(struct inode *inode,
> + struct bdi_writeback *wb)
> +{
> + list_del_init(&inode->i_io_list);
> +}
> +
I think you miss clearing of I_SYNC_QUEUED here. Also you could add here
the lock assertions that are in the other version of
inode_cgwb_move_to_attached().
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists