Linux block layer
 help / color / mirror / Atom feed
From: Dennis Zhou <dennisszhou@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Josef Bacik <josef@toxicpanda.com>,
	kernel-team@fb.com, linux-block@vger.kernel.org,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 09/12] blkcg: remove additional reference to the css
Date: Fri, 7 Sep 2018 16:24:30 -0400	[thread overview]
Message-ID: <20180907202429.GA97913@dennisz-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <20180907175446.GC1100574@devbig004.ftw2.facebook.com>

On Fri, Sep 07, 2018 at 10:54:46AM -0700, Tejun Heo wrote:
> Hello,
> 
> On Thu, Sep 06, 2018 at 05:10:42PM -0400, Dennis Zhou wrote:
> > +struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgrp,
> > +					 struct cgroup_subsys *ss)
> > +{
> > +	struct cgroup_subsys_state *css;
> > +
> > +	rcu_read_lock();
> > +
> > +	do {
> > +		css = cgroup_css(cgrp, ss);
> > +
> > +		if (css)
> > +			goto out_unlock;
> > +		cgrp = cgroup_parent(cgrp);
> > +	} while (cgrp);
> > +
> > +	css = init_css_set.subsys[ss->id];
> > +out_unlock:
> > +	rcu_read_unlock();
> 
> Nothing protects @css here tho.  It can be released before the caller
> is done with it.  The caller must ensure that it's holding rcu read
> lock to protect the lookup and the subsequent uses.  cgroup_css()
> already checks for rcu locking, so if you just drop
> rcu_read_lock/unlock(), everything should work fine.
> 

Ah yes, that's my bad. I've removed it and the unnecessary goto now.

Thanks,
Dennis

  reply	other threads:[~2018-09-07 20:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06 21:10 [PATCH 00/12] block: always associate blkg and refcount cleanup Dennis Zhou
2018-09-06 21:10 ` [PATCH 01/12] blkcg: fix ref count issue with bio_blkcg using task_css Dennis Zhou
2018-09-07 16:52   ` Tejun Heo
2018-09-06 21:10 ` [PATCH 02/12] blkcg: update blkg_lookup_create to do locking Dennis Zhou
2018-09-07  6:17   ` Liu Bo
2018-09-06 21:10 ` [PATCH 03/12] blkcg: convert blkg_lookup_create to find closest blkg Dennis Zhou
2018-09-07 17:27   ` Tejun Heo
2018-09-07 20:33     ` Dennis Zhou
2018-09-06 21:10 ` [PATCH 04/12] blkcg: always associate a bio with a blkg Dennis Zhou
2018-09-06 21:10 ` [PATCH 05/12] blkcg: consolidate bio_issue_init to be a part of core Dennis Zhou
2018-09-07 19:18   ` Liu Bo
2018-09-06 21:10 ` [PATCH 06/12] blkcg: associate a blkg for pages being evicted by swap Dennis Zhou
2018-09-06 21:10 ` [PATCH 07/12] blkcg: associate writeback bios with a blkg Dennis Zhou
2018-09-06 21:10 ` [PATCH 08/12] blkcg: remove bio->bi_css and instead use bio->bi_blkg Dennis Zhou
2018-09-06 21:10 ` [PATCH 09/12] blkcg: remove additional reference to the css Dennis Zhou
2018-09-07 17:54   ` Tejun Heo
2018-09-07 20:24     ` Dennis Zhou [this message]
2018-09-06 21:10 ` [PATCH 10/12] blkcg: cleanup and make blk_get_rl use blkg_lookup_create Dennis Zhou
2018-09-11  5:11   ` [LKP] [blkcg] 1d0e59f90b: BUG:unable_to_handle_kernel kernel test robot
2018-09-06 21:10 ` [PATCH 11/12] blkcg: change blkg reference counting to use percpu_ref Dennis Zhou
2018-09-07 17:59   ` Tejun Heo
2018-09-06 21:10 ` [PATCH 12/12] blkcg: rename blkg_try_get to blkg_tryget Dennis Zhou
  -- strict thread matches above, loose matches on Subject: below --
2018-09-11 18:41 [PATCH v3 00/12] block: always associate blkg and refcount cleanup Dennis Zhou
2018-09-11 18:41 ` [PATCH 09/12] blkcg: remove additional reference to the css Dennis Zhou
2018-09-11 23:51   ` 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=20180907202429.GA97913@dennisz-mbp.dhcp.thefacebook.com \
    --to=dennisszhou@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /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