All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: Hillf Danton <dhillf@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] maximize dispatching in block throttle
Date: Tue, 30 Nov 2010 09:57:12 -0500	[thread overview]
Message-ID: <20101130145712.GD26758@redhat.com> (raw)
In-Reply-To: <AANLkTi=aqMR0uNCgz40pdUG1288CMxLRnZdVxzZuBzGw@mail.gmail.com>

On Fri, Nov 26, 2010 at 10:46:01PM +0800, Hillf Danton wrote:
> When dispatching bio, the quantum is divided into read/write budgets,
> and dispatching for write could not exceed the write budget even if
> the read budget is not exhausted, either dispatching for read.
> 
> It is changed to exhaust the quantum, if possible, in this work for
> dispatching bio.
> 
> Though it is hard to understand that 50/50 division is not selected,
> the difference between divisions could impact little on dispatching as
> much as quantum allows then.
> 
> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> ---

Hi Hillf,

Even if there are not enough READS/WRITES to consume the quantum, I don't
think that it changes anyting much. The next dispatch round will be
scheduled almost immediately (If there are bios which are ready to
be dispatched). Look at throtl_schedule_next_dispatch().

Have you noticed some issues/improvements with this patch?

Generally READS are more latency sensitive as compared to WRITE hence
I thought of dispatching more READS per quantum.

Thanks
Vivek

> 
> --- a/block/blk-throttle.c	2010-11-01 19:54:12.000000000 +0800
> +++ b/block/blk-throttle.c	2010-11-26 21:49:00.000000000 +0800
> @@ -647,11 +647,16 @@ static int throtl_dispatch_tg(struct thr
>  	unsigned int max_nr_reads = throtl_grp_quantum*3/4;
>  	unsigned int max_nr_writes = throtl_grp_quantum - nr_reads;
>  	struct bio *bio;
> +	int read_throttled = 0, write_throttled = 0;
> 
>  	/* Try to dispatch 75% READS and 25% WRITES */
> -
> + try_read:
>  	while ((bio = bio_list_peek(&tg->bio_lists[READ]))
> -		&& tg_may_dispatch(td, tg, bio, NULL)) {
> +		&& ! read_throttled) {
> +		if (! tg_may_dispatch(td, tg, bio, NULL)) {
> +			read_throttled = 1;
> +			break;
> +		}
> 
>  		tg_dispatch_one_bio(td, tg, bio_data_dir(bio), bl);
>  		nr_reads++;
> @@ -659,9 +664,15 @@ static int throtl_dispatch_tg(struct thr
>  		if (nr_reads >= max_nr_reads)
>  			break;
>  	}
> -
> +	if (! bio)
> +		read_throttled = 1;
> + try_write:
>  	while ((bio = bio_list_peek(&tg->bio_lists[WRITE]))
> -		&& tg_may_dispatch(td, tg, bio, NULL)) {
> +		&& ! write_throttled) {
> +		if (! tg_may_dispatch(td, tg, bio, NULL)) {
> +			write_throttled = 1;
> +			break;
> +		}
> 
>  		tg_dispatch_one_bio(td, tg, bio_data_dir(bio), bl);
>  		nr_writes++;
> @@ -669,7 +680,23 @@ static int throtl_dispatch_tg(struct thr
>  		if (nr_writes >= max_nr_writes)
>  			break;
>  	}
> +	if (! bio)
> +		write_throttled = 1;
> +
> +	if (write_throttled && read_throttled)
> +		goto out;
> 
> +	if (! (throtl_grp_quantum > nr_writes + nr_reads))
> +		goto out;
> +		
> +	if (read_throttled) {
> +		max_nr_writes = throtl_grp_quantum - nr_reads;
> +		goto try_write;
> +	} else {
> +		max_nr_reads = throtl_grp_quantum - nr_writes;
> +		goto try_read;
> +	}
> + out:
>  	return nr_reads + nr_writes;
>  }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2010-11-30 14:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-26 14:46 [PATCH] maximize dispatching in block throttle Hillf Danton
2010-11-30 14:57 ` Vivek Goyal [this message]
2010-12-01 13:30   ` Hillf Danton
2010-12-01 14:41     ` Vivek Goyal
2010-12-01 14:56       ` Hillf Danton
2010-12-03 14:26       ` Hillf Danton
2010-12-03 14:32         ` Vivek Goyal
2010-12-03 14:39           ` Hillf Danton
2010-12-04 13:36           ` Hillf Danton
2010-12-06 14:54             ` Vivek Goyal
2010-12-07 13:22               ` Hillf Danton

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=20101130145712.GD26758@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=dhillf@gmail.com \
    --cc=linux-kernel@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.