linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Jan Kara <jack@suse.cz>
Cc: axboe@kernel.dk, linux-kernel@vger.kernel.org,
	cgroups@vger.kernel.org, tytso@mit.edu, dedekind1@gmail.com,
	decui@microsoft.com, kernel-team@fb.com
Subject: Re: [PATCH 3/5] writeback: bdi_writeback iteration must not skip dying ones
Date: Fri, 2 Oct 2015 14:19:10 -0400	[thread overview]
Message-ID: <20151002181910.GA8983@mtj.duckdns.org> (raw)
In-Reply-To: <20151002141212.GA17746@quack.suse.cz>

On Fri, Oct 02, 2015 at 04:12:12PM +0200, Jan Kara wrote:
> > +		if (last_wb) {
> > +			wb_put(last_wb);
> > +			last_wb = NULL;
> > +		}
> 
> But you seem to forget to drop last_wb reference in case this was the last
> wb in the list, don't you?

You're right.  Will update the patch.

> > @@ -686,6 +691,9 @@ static void cgwb_bdi_destroy(struct backing_dev_info *bdi)
> >  	radix_tree_for_each_slot(slot, &bdi->cgwb_tree, &iter, 0)
> >  		cgwb_kill(*slot);
> >  
> > +	/* wb may get released after @bdi is freed, sever list head */
> > +	list_del(&bdi->wb_list);
> > +
> 
> But we wait for bdi->usage_cnt to drop to 0 which means there's no wb,
> don't we? What am I missing?

And I forgot that we were doing that.  This isn't necessary.

> > @@ -764,15 +772,22 @@ static void cgwb_bdi_destroy(struct backing_dev_info *bdi) { }
> >  
> >  int bdi_init(struct backing_dev_info *bdi)
> >  {
> > +	int ret;
> > +
> >  	bdi->dev = NULL;
> >  
> >  	bdi->min_ratio = 0;
> >  	bdi->max_ratio = 100;
> >  	bdi->max_prop_frac = FPROP_FRAC_BASE;
> >  	INIT_LIST_HEAD(&bdi->bdi_list);
> > +	INIT_LIST_HEAD(&bdi->wb_list);
> >  	init_waitqueue_head(&bdi->wb_waitq);
> >  
> > -	return cgwb_bdi_init(bdi);
> > +	ret = cgwb_bdi_init(bdi);
> > +
> > +	list_add_tail_rcu(&bdi->wb.bdi_node, &bdi->wb_list);
> 
> Won't this be more logical in cgwb_bdi_init()?

bdi->wb_list exists whether cgwb is enabled or not, so if we move this
to cgwb_bdi_init(), we'll be duplicating it in both paths.

Thanks.

-- 
tejun

  reply	other threads:[~2015-10-02 18:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-29 16:47 [PATCHSET block/for-linus] writeback: cgroup writeback fixes Tejun Heo
2015-09-29 16:47 ` [PATCH 1/5] writeback: laptop_mode_timer_fn() needs rcu_read_lock() around bdi_writeback iteration Tejun Heo
2015-10-02 14:13   ` Jan Kara
2015-09-29 16:47 ` [PATCH 2/5] writeback: fix bdi_writeback iteration in wakeup_dirtytime_writeback() Tejun Heo
2015-10-02 14:12   ` Jan Kara
2015-09-29 16:47 ` [PATCH 3/5] writeback: bdi_writeback iteration must not skip dying ones Tejun Heo
2015-10-02 14:12   ` Jan Kara
2015-10-02 18:19     ` Tejun Heo [this message]
2015-10-02 18:47   ` [PATCH v2 " Tejun Heo
2015-09-29 16:47 ` [PATCH 4/5] writeback: memcg dirty_throttle_control should be initialized with wb->memcg_completions Tejun Heo
2015-09-29 16:47 ` [PATCH 5/5] writeback: fix incorrect calculation of available memory for memcg domains Tejun Heo
2015-09-29 17:04   ` [PATCH v2 " Tejun Heo
2015-09-29 16:50 ` [PATCHSET block/for-linus] writeback: cgroup writeback fixes Tejun Heo

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=20151002181910.GA8983@mtj.duckdns.org \
    --to=tj@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=decui@microsoft.com \
    --cc=dedekind1@gmail.com \
    --cc=jack@suse.cz \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).