All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Paolo Valente <paolo.valente@linaro.org>
Cc: linux-block <linux-block@vger.kernel.org>,
	Luca Miccio <lucmiccio@gmail.com>,
	hpa@zytor.com, akinobu.mita@gmail.com, dhowells@redhat.com,
	Mark Brown <broonie@kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: high overhead of functions blkg_*stats_* in bfq
Date: Sat, 21 Oct 2017 09:13:37 -0700	[thread overview]
Message-ID: <20171021161337.GP1302522@devbig577.frc2.facebook.com> (raw)
In-Reply-To: <A666837E-ADAB-433A-AFC7-71E59690C0E1@linaro.org>

Hello, Paolo.

On Thu, Oct 19, 2017 at 08:50:17AM +0200, Paolo Valente wrote:
> The blkg obtained through a blkg_lookup, in a rcu_read section, is
> protected.  But, outside that section, a pointer to that blkg is not
> guaranteed to be valid any longer.  Stat-update functions seem safe in

blkg's destruction is rcu delayed.  If you have access to a blkg under
rcu, it won't get freed until the rcu read lock is released.

> cfq and bfq, just because they are executed within locks that happen
> to be taken also before destroying the blkg.  They are the
> request_queue lock for cfq and the scheduler lock for bfq.  Thus, at
> least the request_queue lock apparently needs to be taken around
> stat-update functions in bfq, if they are moved outside the section
> protected by the scheduler lock.

So, a blkg stays alive if the queue lock is held, or the cgroup and
request_queue stays alive, and won't be freed (different from being
alive) as long as RCU read lock is held.

Thanks.

-- 
tejun

  reply	other threads:[~2017-10-21 16:13 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17 10:11 high overhead of functions blkg_*stats_* in bfq Paolo Valente
2017-10-17 12:45 ` Paolo Valente
2017-10-17 16:45   ` Linus Walleij
2017-10-17 16:49     ` Jens Axboe
2017-10-18 13:19 ` Tejun Heo
2017-10-18 14:45   ` Jens Axboe
2017-10-18 15:05     ` Paolo Valente
2017-10-18 15:44       ` Jens Axboe
     [not found]   ` <2B52CB68-213C-470F-945C-0ADFF9AA7A66@linaro.org>
2017-10-18 15:08     ` Paolo Valente
2017-10-18 15:40       ` Paolo Valente
     [not found]       ` <D6586934-DF02-4102-8839-8912DFA86BB0@linaro.org>
2017-10-19  6:50         ` Paolo Valente
2017-10-21 16:13           ` Tejun Heo [this message]
2017-10-22  8:25             ` Paolo Valente
2017-10-30  9:49             ` David Howells
2017-11-05  7:39   ` Paolo Valente
2017-11-06  2:21     ` Jens Axboe
2017-11-06  9:22       ` Ulf Hansson
2017-11-06  9:49         ` Paolo Valente
2017-11-06 10:48           ` Ulf Hansson
2017-11-06 11:20             ` Paolo Valente
2017-11-06 15:00       ` Tejun Heo
2017-11-06 15:47         ` Paolo Valente
2017-11-06 16:11           ` Paolo Valente
2017-11-06 16:13             ` Jens Axboe
2017-11-06 16:21               ` Paolo Valente
2017-11-06 16:22                 ` Jens Axboe
2017-11-06 16:26                   ` Paolo Valente
2017-11-06 16:30                     ` Tejun Heo
2017-11-06 16:33                       ` Paolo Valente
2017-11-06 16:37                         ` Tejun Heo
2017-11-06 16:39                           ` Jens Axboe
2017-11-06 17:05                             ` Paolo Valente
2017-11-06 16:03         ` Jens Axboe
2017-11-06 16:10           ` Paolo Valente
2017-11-06 18:46       ` Paolo Valente

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=20171021161337.GP1302522@devbig577.frc2.facebook.com \
    --to=tj@kernel.org \
    --cc=akinobu.mita@gmail.com \
    --cc=broonie@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-block@vger.kernel.org \
    --cc=lucmiccio@gmail.com \
    --cc=paolo.valente@linaro.org \
    --cc=ulf.hansson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.