Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1589887

Re: [PATCH] blkcg: allocate struct blkcg_gq outside request queue spinlock

From Tahsin Erdogan <tahsin@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH] blkcg: allocate struct blkcg_gq outside request queue spinlock
Date 2017-03-01 01:10 +0100
Message-ID <tg009-3dN-1@gated-at.bofh.it> (permalink)
References <tfIFX-8oQ-11@gated-at.bofh.it> <tfYUq-2fP-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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).

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] blkcg: allocate struct blkcg_gq outside request queue spinlock Tahsin Erdogan <tahsin@google.com> - 2017-02-28 06:40 +0100
  Re: [PATCH] blkcg: allocate struct blkcg_gq outside request queue  spinlock Tejun Heo <tj@kernel.org> - 2017-03-01 00:00 +0100
    Re: [PATCH] blkcg: allocate struct blkcg_gq outside request queue spinlock Tahsin Erdogan <tahsin@google.com> - 2017-03-01 01:10 +0100
      Re: [PATCH] blkcg: allocate struct blkcg_gq outside request queue  spinlock Tejun Heo <tj@kernel.org> - 2017-03-01 18:00 +0100
        Re: [PATCH v2] blkcg: allocate struct blkcg_gq outside request queue spinlock Tahsin Erdogan <tahsin@google.com> - 2017-03-02 01:20 +0100
        [PATCH v2] blkcg: allocate struct blkcg_gq outside request queue spinlock Tahsin Erdogan <tahsin@google.com> - 2017-03-02 04:00 +0100
          Re: [PATCH v2] blkcg: allocate struct blkcg_gq outside request queue  spinlock Tejun Heo <tj@kernel.org> - 2017-03-02 20:50 +0100
            Re: [PATCH v2] blkcg: allocate struct blkcg_gq outside request queue spinlock Tahsin Erdogan <tahsin@google.com> - 2017-03-02 23:50 +0100
              Re: [PATCH v2] blkcg: allocate struct blkcg_gq outside request queue  spinlock Tejun Heo <tj@kernel.org> - 2017-03-03 20:30 +0100
                [PATCH v3] blkcg: allocate struct blkcg_gq outside request queue spinlock Tahsin Erdogan <tahsin@google.com> - 2017-03-04 02:50 +0100
                Re: [PATCH v3] blkcg: allocate struct blkcg_gq outside request queue  spinlock Tejun Heo <tj@kernel.org> - 2017-03-04 20:30 +0100
                Re: [PATCH v4] blkcg: allocate struct blkcg_gq outside request queue spinlock Tahsin Erdogan <tahsin@google.com> - 2017-03-05 15:30 +0100
                [PATCH v4] blkcg: allocate struct blkcg_gq outside request queue spinlock Tahsin Erdogan <tahsin@google.com> - 2017-03-05 15:30 +0100
                Re: [PATCH v4] blkcg: allocate struct blkcg_gq outside request queue  spinlock Tejun Heo <tj@kernel.org> - 2017-03-06 21:10 +0100
                [PATCH v5] blkcg: allocate struct blkcg_gq outside request queue spinlock Tahsin Erdogan <tahsin@google.com> - 2017-03-09 09:10 +0100
                Re: [PATCH v5] blkcg: allocate struct blkcg_gq outside request queue  spinlock Tejun Heo <tj@kernel.org> - 2017-03-09 19:30 +0100
                Re: [PATCH v5] blkcg: allocate struct blkcg_gq outside request queue  spinlock Jens Axboe <axboe@kernel.dk> - 2017-03-11 23:50 +0100
                Re: [PATCH v5] blkcg: allocate struct blkcg_gq outside request queue  spinlock Jens Axboe <axboe@kernel.dk> - 2017-03-12 00:00 +0100
                Re: [PATCH v5] blkcg: allocate struct blkcg_gq outside request queue spinlock Tahsin Erdogan <tahsin@google.com> - 2017-03-12 05:40 +0100
                Re: [PATCH v5] blkcg: allocate struct blkcg_gq outside request queue  spinlock Jens Axboe <axboe@kernel.dk> - 2017-03-13 15:40 +0100
                Re: [PATCH v5] blkcg: allocate struct blkcg_gq outside request queue spinlock Tahsin Erdogan <tahsin@google.com> - 2017-03-13 17:20 +0100
                Re: [lkp-robot] [blkcg] ad63af3cb7: BUG:sleeping_function_called_from_invalid_context_at_mm/slab.h Tahsin Erdogan <tahsin@google.com> - 2017-03-09 09:10 +0100

csiph-web