mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: Jens Axboe <jens.axboe@oracle.com>,
	linux kernel mailing list <linux-kernel@vger.kernel.org>,
	Gui Jianfeng <guijianfeng@cn.fujitsu.com>
Subject: Re: [PATCH] cfq-iosched: Wait for next request if we are about to expire the queue
Date: Tue, 08 Dec 2009 12:52:48 -0500	[thread overview]
Message-ID: <x49zl5tfj4f.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <20091208150412.GC28615@redhat.com> (Vivek Goyal's message of "Tue, 8 Dec 2009 10:04:12 -0500")

Vivek Goyal <vgoyal@redhat.com> writes:

> If there is a sequential reader running in a group, we wait for next request
> to come in that group after slice expiry and once new request is in, we expire
> the queue. Otherwise we delete the group from service tree and group looses
> its fair share.
>
> So far I was marking a queue as wait_busy if it had consumed its slice and
> it was last queue in the group. But this condition did not cover following
> two cases.
>
> - If think time of process is more than slice left, we will not arm the timer
>   and queue will be expired. 
>
> - If we hit the boundary condition where slice has not expired after request
>   completion but almost immediately after (4-5 ns), select_queue() hits and
>   by that time slice has expired because jiffies has incremented by one.
>
> Gui was hitting the boundary condition and not getting fairness numbers
> proportional to weight.
>
> This patch puts the checks for above two conditions and improves the fairness
> numbers for sequential workload on rotational media.
>
> Reported-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com> 
> Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> Acked-by: Gui Jianfeng <guijiafneng@cn.fujitsu.com>
> ---
>  block/cfq-iosched.c |   30 ++++++++++++++++++++++++++----
>  1 file changed, 26 insertions(+), 4 deletions(-)
>
> Index: linux1/block/cfq-iosched.c
> ===================================================================
> --- linux1.orig/block/cfq-iosched.c	2009-12-07 14:40:03.000000000 -0500
> +++ linux1/block/cfq-iosched.c	2009-12-07 14:40:04.000000000 -0500
> @@ -3251,6 +3251,29 @@ static void cfq_update_hw_tag(struct cfq
>  		cfqd->hw_tag = 0;
>  }
>  
> +static inline bool
> +cfq_should_wait_busy(struct cfq_data *cfqd, struct cfq_queue *cfqq)
> +{
> +	struct cfq_io_context *cic = cfqd->active_cic;
> +
> +	/* If there are other queues in the group, don't wait */
> +	if (cfqq->cfqg->nr_cfqq > 1)
> +		return false;
> +
> +	if (cfq_slice_used(cfqq))
> +		return true;
> +
> +	if (cfqq->slice_end - jiffies == 1)
> +		return true;

This really looks like a hack.  At the very least, it requires a big
comment above it explaining why it's there.  Would it be possible to
detect such a condition in select_queue and handle it there?

Cheers,
Jeff

  reply	other threads:[~2009-12-08 17:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-08 15:04 Vivek Goyal
2009-12-08 17:52 ` Jeff Moyer [this message]
2009-12-08 22:50   ` Vivek Goyal

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=x49zl5tfj4f.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=guijianfeng@cn.fujitsu.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vgoyal@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®