All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
To: bo.liu@linux.alibaba.com
Cc: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] blk-throttle: fix zero wait time for iops throttled group
Date: Tue, 9 Jul 2019 10:18:36 +0300	[thread overview]
Message-ID: <2240c382-502d-d112-418b-d44aa67d0ab2@yandex-team.ru> (raw)
In-Reply-To: <20190708190809.l4fdhigexzdujvuv@US-160370MP2.local>

On 08.07.2019 22:08, Liu Bo wrote:
> On Mon, Jul 08, 2019 at 06:29:57PM +0300, Konstantin Khlebnikov wrote:
>> After commit 991f61fe7e1d ("Blk-throttle: reduce tail io latency when iops
>> limit is enforced") wait time could be zero even if group is throttled and
>> cannot issue requests right now. As a result throtl_select_dispatch() turns
>> into busy-loop under irq-safe queue spinlock.
>>
>> Fix is simple: always round up target time to the next throttle slice.
>>
>> Fixes: 991f61fe7e1d ("Blk-throttle: reduce tail io latency when iops limit is enforced")
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
>> Cc: stable@vger.kernel.org # v4.19+
>> ---
>>   block/blk-throttle.c |    9 +++------
>>   1 file changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/block/blk-throttle.c b/block/blk-throttle.c
>> index 9ea7c0ecad10..8ab6c8153223 100644
>> --- a/block/blk-throttle.c
>> +++ b/block/blk-throttle.c
>> @@ -881,13 +881,10 @@ static bool tg_with_in_iops_limit(struct throtl_grp *tg, struct bio *bio,
>>   	unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd;
>>   	u64 tmp;
>>   
>> -	jiffy_elapsed = jiffy_elapsed_rnd = jiffies - tg->slice_start[rw];
>> -
>> -	/* Slice has just started. Consider one slice interval */
>> -	if (!jiffy_elapsed)
>> -		jiffy_elapsed_rnd = tg->td->throtl_slice;
>> +	jiffy_elapsed = jiffies - tg->slice_start[rw];
>>   
>> -	jiffy_elapsed_rnd = roundup(jiffy_elapsed_rnd, tg->td->throtl_slice);
>> +	/* Round up to the next throttle slice, wait time must be nonzero */
>> +	jiffy_elapsed_rnd = roundup(jiffy_elapsed + 1, tg->td->throtl_slice);
>>   
>>   	/*
>>   	 * jiffy_elapsed_rnd should not be a big value as minimum iops can be
> 
> Did you use a tiny iops limit to run into this?

Yep. 25 iops

also kernel built with HZ=250, this might be related

> 
> thanks,
> -liubo
> 

  reply	other threads:[~2019-07-09  7:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08 15:29 [PATCH] blk-throttle: fix zero wait time for iops throttled group Konstantin Khlebnikov
2019-07-08 19:08 ` Liu Bo
2019-07-09  7:18   ` Konstantin Khlebnikov [this message]
2019-07-10 10:42 ` Konstantin Khlebnikov
2019-07-10 14:00 ` Jens Axboe
2019-07-10 14:24   ` Konstantin Khlebnikov
2019-07-10 14:25     ` Jens Axboe

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=2240c382-502d-d112-418b-d44aa67d0ab2@yandex-team.ru \
    --to=khlebnikov@yandex-team.ru \
    --cc=axboe@kernel.dk \
    --cc=bo.liu@linux.alibaba.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.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 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.