linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
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 2/5] writeback, cgroup: keep list of inodes attached to bdi_writeback
Date: Thu, 3 Jun 2021 10:55:33 +0200	[thread overview]
Message-ID: <20210603085533.GE23647@quack2.suse.cz> (raw)
In-Reply-To: <20210603005517.1403689-3-guro@fb.com>

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


  reply	other threads:[~2021-06-03  8:55 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 [this message]
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
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=20210603085533.GE23647@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