lkml.org 
[lkml]   [2021]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@suse.cz>
> Signed-off-by: Roman Gushchin <guro@fb.com>

Looks good, just one small comment below, with that fixed feel free to add:

Reviewed-by: Jan Kara <jack@suse.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@suse.com>
SUSE Labs, CR

\
 
 \ /
  Last update: 2021-06-03 10:55    [W:0.083 / U:21.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site