From: Vivek Goyal <vgoyal@redhat.com>
To: linux-kernel@vger.kernel.org, axboe@kernel.dk
Cc: tj@kernel.org, cgroups@vger.kernel.org, vgoyal@redhat.com
Subject: [PATCH 10/15] cfq-get-rid-of-slice-offset-and-always-put-new-queue-at-the-end-2
Date: Mon, 1 Oct 2012 15:32:51 -0400 [thread overview]
Message-ID: <1349119976-26837-11-git-send-email-vgoyal@redhat.com> (raw)
In-Reply-To: <1349119976-26837-1-git-send-email-vgoyal@redhat.com>
Currently cfq does round robin among cfqq and allocates bigger slices
to higher prio queue. But it also does additional logic of putting
higher priority queues ahead of lower priority queues in the service
tree. cfq_slice_offset() determines the postion of a queue in the
service tree.
I think it was done so that higher prio queues can get even higher
share of disk. As I am planning to move to vdisktime logic, this
does not fit anymore in to scheme of things. In the end of patch
series, I will introduce another approximation which provides vdisktime
boost based on weight. So that will kind of emulate this logic to
provide higher prio queues more than fair share of disk.
So this patch puts every new queue at the end of service tree by
default. Existing queues get their position in the tree depending
on how much slice did they use recently and what's their prio/weight.
This patch only introduces the functionality of adding queues at
the end of service tree. Later patches will introduce the functionality
of determining vdisktime (hence position in service tree) based on
slice used and weight.
If a queue is being requeued, then it will already be on service tree
and we can't determine the rb_key of last element using cfq_rb_last().
So we always remove the queue from service tree first.
This is just an intermediate patch to show clearly how I am chaning
existing functionality. Did not want to lump it together with bigger
patches.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
block/cfq-iosched.c | 51 ++++++++++++++++++---------------------------------
1 files changed, 18 insertions(+), 33 deletions(-)
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 76f020f..bf2bc32 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1139,16 +1139,6 @@ cfq_find_next_rq(struct cfq_data *cfqd, struct cfq_queue *cfqq,
return cfq_choose_req(cfqd, next, prev, blk_rq_pos(last));
}
-static unsigned long cfq_slice_offset(struct cfq_data *cfqd,
- struct cfq_queue *cfqq)
-{
- /*
- * just an approximation, should be ok.
- */
- return (cfqq->cfqg->nr_cfqq - 1) * (cfq_prio_slice(cfqd, 1, 0) -
- cfq_prio_slice(cfqd, cfq_cfqq_sync(cfqq), cfqq->ioprio));
-}
-
static inline s64
cfqg_key(struct cfq_rb_root *st, struct cfq_group *cfqg)
{
@@ -1625,41 +1615,36 @@ static void cfq_st_add(struct cfq_data *cfqd, struct cfq_queue *cfqq,
bool new_cfqq = RB_EMPTY_NODE(&cfqq->rb_node);
st = st_for(cfqq->cfqg, cfqq_class(cfqq), cfqq_type(cfqq));
- if (cfq_class_idle(cfqq)) {
+
+ if (!new_cfqq) {
+ cfq_rb_erase(&cfqq->rb_node, cfqq->st);
+ cfqq->st = NULL;
+ }
+
+ if (!add_front) {
rb_key = CFQ_IDLE_DELAY;
parent = rb_last(&st->rb);
- if (parent && parent != &cfqq->rb_node) {
+ if (parent) {
__cfqq = rb_entry(parent, struct cfq_queue, rb_node);
rb_key += __cfqq->rb_key;
} else
rb_key += jiffies;
- } else if (!add_front) {
- /*
- * Get our rb key offset. Subtract any residual slice
- * value carried from last service. A negative resid
- * count indicates slice overrun, and this should position
- * the next service time further away in the tree.
- */
- rb_key = cfq_slice_offset(cfqd, cfqq) + jiffies;
- rb_key -= cfqq->slice_resid;
- cfqq->slice_resid = 0;
+ if (!cfq_class_idle(cfqq)) {
+ /*
+ * Subtract any residual slice * value carried from
+ * last service. A negative resid count indicates
+ * slice overrun, and this should position
+ * the next service time further away in the tree.
+ */
+ rb_key -= cfqq->slice_resid;
+ cfqq->slice_resid = 0;
+ }
} else {
rb_key = -HZ;
__cfqq = cfq_rb_first(st);
rb_key += __cfqq ? __cfqq->rb_key : jiffies;
}
- if (!new_cfqq) {
- /*
- * same position, nothing more to do
- */
- if (rb_key == cfqq->rb_key && cfqq->st == st)
- return;
-
- cfq_rb_erase(&cfqq->rb_node, cfqq->st);
- cfqq->st = NULL;
- }
-
left = 1;
parent = NULL;
cfqq->st = st;
--
1.7.7.6
next prev parent reply other threads:[~2012-10-01 19:32 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-01 19:32 [RFC PATCH 00/15] Use vdisktime based scheduling logic for cfq queues Vivek Goyal
2012-10-01 19:32 ` [PATCH 01/15] cfq-iosched: Properly name all references to IO class Vivek Goyal
[not found] ` <1349119976-26837-2-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-10-01 20:51 ` Jeff Moyer
2012-10-03 0:54 ` Tejun Heo
2012-10-03 13:06 ` Vivek Goyal
2012-10-01 19:32 ` Vivek Goyal [this message]
2012-10-01 19:32 ` [PATCH 13/15] cfq-iosched: Use same scheduling algorithm for groups and queues Vivek Goyal
[not found] ` <1349119976-26837-1-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-10-01 19:32 ` [PATCH 02/15] cfq-iosched: More renaming to better represent wl_class and wl_type Vivek Goyal
2012-10-01 20:50 ` Jeff Moyer
2012-10-02 13:25 ` Vivek Goyal
2012-10-01 19:32 ` [PATCH 03/15] cfq-iosched: Rename "service_tree" to "st" Vivek Goyal
[not found] ` <1349119976-26837-4-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-10-01 20:52 ` Jeff Moyer
[not found] ` <x49ipatj4oy.fsf-RRHT56Q3PSP4kTEheFKJxxDDeQx5vsVwAInAS/Ez/D0@public.gmane.org>
2012-10-02 13:26 ` Vivek Goyal
[not found] ` <20121002132603.GB758-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-10-03 0:59 ` Tejun Heo
2012-10-01 19:32 ` [PATCH 04/15] cfq-iosched: Rename few functions related to selecting workload Vivek Goyal
[not found] ` <1349119976-26837-5-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-10-01 20:55 ` Jeff Moyer
2012-10-01 19:32 ` [PATCH 05/15] cfq-iosched: Get rid of unnecessary local variable Vivek Goyal
[not found] ` <1349119976-26837-6-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-10-01 20:57 ` Jeff Moyer
2012-10-01 19:32 ` [PATCH 06/15] cfq-iosched: Print sync-noidle information in blktrace messages Vivek Goyal
[not found] ` <1349119976-26837-7-git-send-email-vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-10-01 21:01 ` Jeff Moyer
2012-10-01 19:32 ` [PATCH 07/15] cfq-iosced: Do the round robin selection of workload type Vivek Goyal
2012-10-01 19:32 ` [PATCH 08/15] cfq-iosched: Make cfq_scale_slice() usable for both queues and groups Vivek Goyal
2012-10-01 19:32 ` [PATCH 09/15] cfq-iosched: make new_cfqq variable bool Vivek Goyal
2012-10-01 19:32 ` [PATCH 11/15] cfq-iosched: Remove residual slice logic Vivek Goyal
2012-10-01 19:32 ` [PATCH 12/15] cfq-iosched: put cooperating queue at the front of service tree Vivek Goyal
2012-10-01 19:32 ` [PATCH 14/15] cfq-iosched: Wait for queue to get busy even if this is not last queue in group Vivek Goyal
2012-10-01 19:32 ` [PATCH 15/15] cfq-ioschd: Give boost to higher prio/weight queues 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=1349119976-26837-11-git-send-email-vgoyal@redhat.com \
--to=vgoyal@redhat.com \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).