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


Groups > linux.kernel > #1593685

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

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v4] blkcg: allocate struct blkcg_gq outside request queue spinlock
Date 2017-03-06 21:10 +0100
Message-ID <ti77c-4Of-17@gated-at.bofh.it> (permalink)
References <thnxn-5re-15@gated-at.bofh.it> <thFkB-1yo-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Mar 05, 2017 at 06:12:43AM -0800, Tahsin Erdogan wrote:
> blkg_conf_prep() currently calls blkg_lookup_create() while holding
> request queue spinlock. This means allocating memory for struct
> blkcg_gq has to be made non-blocking. This causes occasional -ENOMEM
> failures in call paths like below:
> 
>   pcpu_alloc+0x68f/0x710
>   __alloc_percpu_gfp+0xd/0x10
>   __percpu_counter_init+0x55/0xc0
>   cfq_pd_alloc+0x3b2/0x4e0
>   blkg_alloc+0x187/0x230
>   blkg_create+0x489/0x670
>   blkg_lookup_create+0x9a/0x230
>   blkg_conf_prep+0x1fb/0x240
>   __cfqg_set_weight_device.isra.105+0x5c/0x180
>   cfq_set_weight_on_dfl+0x69/0xc0
>   cgroup_file_write+0x39/0x1c0
>   kernfs_fop_write+0x13f/0x1d0
>   __vfs_write+0x23/0x120
>   vfs_write+0xc2/0x1f0
>   SyS_write+0x44/0xb0
>   entry_SYSCALL_64_fastpath+0x18/0xad
> 
> In the code path above, percpu allocator cannot call vmalloc() due to
> queue spinlock.
> 
> A failure in this call path gives grief to tools which are trying to
> configure io weights. We see occasional failures happen shortly after
> reboots even when system is not under any memory pressure. Machines
> with a lot of cpus are more vulnerable to this condition.
> 
> Update blkg_create() function to temporarily drop the rcu and queue
> locks when it is allowed by gfp mask.
> 
> Suggested-by: Tejun Heo <tj@kernel.org>
> Signed-off-by: Tahsin Erdogan <tahsin@google.com>

Cc: stable@vger.kernel.org # v4.2+

Looks good to me.

 Acked-by: Tejun Heo <tj@kernel.org>

Thanks for your patience!

-- 
tejun

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


Thread

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