From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-f67.google.com ([209.85.214.67]:52268 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966104AbeF0TGf (ORCPT ); Wed, 27 Jun 2018 15:06:35 -0400 Received: by mail-it0-f67.google.com with SMTP id p4-v6so1703988itf.2 for ; Wed, 27 Jun 2018 12:06:35 -0700 (PDT) Subject: Re: [PATCH 12/15] block: introduce blk-iolatency io controller To: Josef Bacik , linux-block@vger.kernel.org, kernel-team@fb.com, akpm@linux-foundation.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, tj@kernel.org, linux-fsdevel@vger.kernel.org Cc: Josef Bacik References: <20180625151243.2132-1-josef@toxicpanda.com> <20180625151243.2132-13-josef@toxicpanda.com> From: Jens Axboe Message-ID: <05a581ed-8f21-9d89-a813-a03d802d3469@kernel.dk> Date: Wed, 27 Jun 2018 13:06:31 -0600 MIME-Version: 1.0 In-Reply-To: <20180625151243.2132-13-josef@toxicpanda.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 6/25/18 9:12 AM, Josef Bacik wrote: > +static void __blkcg_iolatency_throttle(struct rq_qos *rqos, > + struct iolatency_grp *iolat, > + spinlock_t *lock, bool issue_as_root, > + bool use_memdelay) > + __releases(lock) > + __acquires(lock) > +{ > + struct rq_wait *rqw = &iolat->rq_wait; > + unsigned use_delay = atomic_read(&lat_to_blkg(iolat)->use_delay); > + DEFINE_WAIT(wait); > + bool first_block = true; > + > + if (use_delay) > + blkcg_schedule_throttle(rqos->q, use_memdelay); > + > + /* > + * To avoid priority inversions we want to just take a slot if we are > + * issuing as root. If we're being killed off there's no point in > + * delaying things, we may have been killed by OOM so throttling may > + * make recovery take even longer, so just let the IO's through so the > + * task can go away. > + */ > + if (issue_as_root || fatal_signal_pending(current)) { > + atomic_inc(&rqw->inflight); > + return; > + } > + > + if (iolatency_may_queue(iolat, &wait, first_block)) > + return; > + > + do { > + prepare_to_wait_exclusive(&rqw->wait, &wait, > + TASK_UNINTERRUPTIBLE); > + > + iolatency_may_queue(iolat, &wait, first_block); > + first_block = false; > + > + if (lock) { > + spin_unlock_irq(lock); > + io_schedule(); > + spin_lock_irq(lock); > + } else { > + io_schedule(); > + } > + } while (1); So how does this wait loop ever exit? -- Jens Axboe