linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tahsin Erdogan <tahsin@google.com>
To: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, David Rientjes <rientjes@google.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] blkcg: allocate struct blkcg_gq outside request queue spinlock
Date: Tue, 28 Feb 2017 15:51:27 -0800	[thread overview]
Message-ID: <CAAeU0aMMmWagAKc_nUoZj77EYiuiyhdtPZ35C4Yk6BPG-_=kxg@mail.gmail.com> (raw)
In-Reply-To: <20170228224728.GJ15287@htj.duckdns.org>

On Tue, Feb 28, 2017 at 2:47 PM, Tejun Heo <tj@kernel.org> wrote:
>> +     if (!blkcg_policy_enabled(q, pol)) {
>> +             ret = -EOPNOTSUPP;
>> +             goto fail;
>
> Pulling this out of the queue_lock doesn't seem safe to me.  This
> function may end up calling into callbacks of disabled policies this
> way.

I will move this to within the lock. To make things safe, I am also
thinking of rechecking both blkcg_policy_enabled()  and
blk_queue_bypass() after reacquiring the locks in each iteration.

>> +             parent = blkcg_parent(blkcg);
>> +             while (parent && !__blkg_lookup(parent, q, false)) {
>> +                     pos = parent;
>> +                     parent = blkcg_parent(parent);
>> +             }
>
> Hmm... how about adding @new_blkg to blkg_lookup_create() and calling
> it with non-NULL @new_blkg until it succeeds?  Wouldn't that be
> simpler?
>
>> +
>> +             new_blkg = blkg_alloc(pos, q, GFP_KERNEL);

The challenge with that approach is creating a new_blkg with the right
blkcg before passing to blkg_lookup_create(). blkg_lookup_create()
walks down the hierarchy and will try to fill the first missing entry
and the preallocated new_blkg must have been created with the right
blkcg (feel free to send a code fragment if you think I am
misunderstanding the suggestion).

  reply	other threads:[~2017-02-28 23:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28  2:49 [PATCH] blkcg: allocate struct blkcg_gq outside request queue spinlock Tahsin Erdogan
2017-02-28 22:47 ` Tejun Heo
2017-02-28 23:51   ` Tahsin Erdogan [this message]
2017-03-01 16:55     ` Tejun Heo
2017-03-01 23:43       ` [PATCH v2] " Tahsin Erdogan
2017-03-01 23:49         ` Tahsin Erdogan
2017-03-02 19:32         ` Tejun Heo
2017-03-02 22:33           ` Tahsin Erdogan
2017-03-03 19:23             ` Tejun Heo
2017-03-04  1:40               ` [PATCH v3] " Tahsin Erdogan
2017-03-04 19:23                 ` Tejun Heo
2017-03-05 14:12                   ` [PATCH v4] " Tahsin Erdogan
2017-03-05 14:24                     ` Tahsin Erdogan
2017-03-06 20:03                     ` Tejun Heo
2017-03-09  8:05                       ` [PATCH v5] " Tahsin Erdogan
2017-03-09 18:27                         ` Tejun Heo
2017-03-11 22:42                         ` Jens Axboe
2017-03-11 22:52                           ` Jens Axboe
2017-03-12  4:35                             ` Tahsin Erdogan
2017-03-13 14:32                               ` Jens Axboe
2017-03-13 16:17                                 ` Tahsin Erdogan
2017-03-24 21:56                                   ` [PATCH] " Tahsin Erdogan
2017-03-24 22:04                                     ` Jens Axboe
2017-03-28 21:53                                       ` Tejun Heo
2017-03-28 21:59                         ` [PATCH v5] " Jens Axboe
2017-03-28 22:01                           ` Tahsin Erdogan
2017-03-09  5:25                 ` [lkp-robot] [blkcg] ad63af3cb7: BUG:sleeping_function_called_from_invalid_context_at_mm/slab.h kernel test robot
2017-03-09  7:59                   ` Tahsin Erdogan
2017-03-26 10:54 [PATCH] blkcg: allocate struct blkcg_gq outside request queue spinlock Julia Lawall
2017-03-27 18:29 ` Tahsin Erdogan

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='CAAeU0aMMmWagAKc_nUoZj77EYiuiyhdtPZ35C4Yk6BPG-_=kxg@mail.gmail.com' \
    --to=tahsin@google.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    --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;
as well as URLs for NNTP newsgroup(s).