From: "Satoshi UCHIDA" <s-uchida@ap.jp.nec.com>
To: <linux-kernel@vger.kernel.org>,
<containers@lists.linux-foundation.org>,
<virtualization@lists.linux-foundation.org>,
<jens.axboe@oracle.com>, "'Ryo Tsuruta'" <ryov@valinux.co.jp>,
"'Andrea Righi'" <righi.andrea@gmail.com>, <ngupta@google.com>,
<fernando@oss.ntt.co.jp>, <vtaras@openvz.org>
Cc: "'Andrew Morton'" <akpm@linux-foundation.org>,
"'SUGAWARA Tomoyoshi'" <tom-sugawara@ap.jp.nec.com>,
<menage@google.com>, <balbir@linux.vnet.ibm.com>
Subject: [PATCH][cfq-cgroups][11/12] Expand idle slice timer function.
Date: Wed, 12 Nov 2008 17:31:05 +0900 [thread overview]
Message-ID: <001801c944a1$011b0060$03510120$@jp.nec.com> (raw)
In-Reply-To: <000c01c9449e$c5bcdc20$51369460$@jp.nec.com>
This patch expandes function of idle slice timer.
Signed-off-by: Satoshi UCHIDA <s-uchida@ap.jp.nec.com>
---
block/cfq-cgroup.c | 45 +++++++++++++++++++++++++++++++++++++++++++
block/cfq-iosched.c | 29 ++++++++++++++++++++++-----
include/linux/cfq-iosched.h | 3 ++
3 files changed, 71 insertions(+), 6 deletions(-)
diff --git a/block/cfq-cgroup.c b/block/cfq-cgroup.c
index f3e9f40..4938fa0 100644
--- a/block/cfq-cgroup.c
+++ b/block/cfq-cgroup.c
@@ -69,9 +69,16 @@ static inline struct cfq_cgroup *task_to_cfq_cgroup(struct task_struct *tsk)
/*
* Add device or cgroup data functions.
*/
+static void cfq_cgroup_idle_slice_timer(unsigned long data);
+
static void cfq_cgroup_init_driver_data_opt(struct cfq_driver_data *cfqdd,
struct cfq_data *cfqd)
{
+ cfqdd->elv_data = cfqd;
+
+ cfqdd->idle_slice_timer.function = cfq_cgroup_idle_slice_timer;
+ cfqdd->idle_slice_timer.data = (unsigned long) cfqdd;
+
cfqdd->sibling_tree = RB_ROOT;
cfqdd->siblings = 0;
@@ -623,6 +630,44 @@ static int cfq_cgroup_is_active_data(struct cfq_data *cfqd)
/*
+ * Timer running if the active_queue is currently idling inside its time slice
+ */
+static void cfq_cgroup_idle_slice_timer(unsigned long data)
+{
+ struct cfq_driver_data *cfqdd = (struct cfq_driver_data *) data;
+ struct cfq_data *cfqd;
+ int timed_out = 1;
+ unsigned long flags;
+
+ spin_lock_irqsave(cfqdd->queue->queue_lock, flags);
+
+ cfqd = cfqdd->active_data;
+ if (cfqd) {
+ timed_out = 0;
+
+ if (cfq_cgroup_slice_used(cfqd))
+ goto expire_cgroup;
+
+ if (!cfqdd->busy_data)
+ goto out_cont;
+
+ if (__cfq_idle_slice_timer(cfqd))
+ goto out_cont;
+ else
+ goto out_kick;
+
+ }
+expire_cgroup:
+ cfq_cgroup_slice_expired(cfqdd, timed_out);
+out_kick:
+ cfq_schedule_dispatch(cfqdd->elv_data);
+out_cont:
+ spin_unlock_irqrestore(cfqdd->queue->queue_lock,
+ flags);
+}
+
+
+/*
* cgroupfs parts below -->
*/
static void
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 5fe0551..edc23e5 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2122,18 +2122,13 @@ static void cfq_kick_queue(struct work_struct *work)
/*
* Timer running if the active_queue is currently idling inside its time slice
*/
-static void cfq_idle_slice_timer(unsigned long data)
+inline int __cfq_idle_slice_timer(struct cfq_data *cfqd)
{
- struct cfq_data *cfqd = (struct cfq_data *) data;
struct cfq_queue *cfqq;
- struct cfq_driver_data *cfqdd = cfqd->cfqdd;
- unsigned long flags;
int timed_out = 1;
cfq_log(cfqd, "idle timer fired");
- spin_lock_irqsave(cfqdd->queue->queue_lock, flags);
-
cfqq = cfqd->active_queue;
if (cfqq) {
timed_out = 0;
@@ -2163,7 +2158,21 @@ expire:
cfq_slice_expired(cfqd, timed_out);
out_kick:
cfq_schedule_dispatch(cfqd);
+ return 1;
out_cont:
+ return 0;
+}
+
+static void cfq_idle_slice_timer(unsigned long data)
+{
+ struct cfq_data *cfqd = (struct cfq_data *) data;
+ struct cfq_driver_data *cfqdd = cfqd->cfqdd;
+ unsigned long flags;
+
+ spin_lock_irqsave(cfqdd->queue->queue_lock, flags);
+
+ __cfq_idle_slice_timer(cfqd);
+
spin_unlock_irqrestore(cfqdd->queue->queue_lock, flags);
}
@@ -2226,6 +2235,13 @@ static void cfq_exit_queue(elevator_t *e)
kfree(cfqdd);
}
+static void
+cfq_init_driver_data_opt(struct cfq_driver_data *cfqdd, struct cfq_data *cfqd)
+{
+ cfqdd->idle_slice_timer.function = cfq_idle_slice_timer;
+ cfqdd->idle_slice_timer.data = (unsigned long) cfqd;
+}
+
static struct cfq_driver_data *
cfq_init_driver_data(struct request_queue *q, struct cfq_data *cfqd,
struct cfq_ops *op)
@@ -2441,6 +2457,7 @@ struct elevator_type iosched_cfq = {
};
static struct cfq_ops cfq_op = {
+ .cfq_init_driver_data_opt_fn = cfq_init_driver_data_opt,
};
static int __init cfq_init(void)
diff --git a/include/linux/cfq-iosched.h b/include/linux/cfq-iosched.h
index 7287186..920bcb5 100644
--- a/include/linux/cfq-iosched.h
+++ b/include/linux/cfq-iosched.h
@@ -24,6 +24,7 @@ struct cfq_rb_root {
* Driver unique data structure
*/
struct cfq_driver_data {
+ struct cfq_data *elv_data;
struct request_queue *queue;
int rq_in_driver;
@@ -156,5 +157,7 @@ extern void cfq_slice_expired(struct cfq_data *, int);
extern int wait_request_checker(struct cfq_data *cfqd);
extern int cfq_forced_dispatch(struct cfq_data *);
extern int cfq_queue_dispatch_requests(struct cfq_data *, int);
+extern int __cfq_idle_slice_timer(struct cfq_data *cfqd);
+extern void cfq_schedule_dispatch(struct cfq_data *cfqd);
#endif /* _LINUX_CFQ_IOSCHED_H */
--
1.5.6.5
next prev parent reply other threads:[~2008-11-12 8:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-12 8:15 [PATCH][RFC][12+2][v3] A expanded CFQ scheduler for cgroups Satoshi UCHIDA
2008-11-12 8:23 ` [PATCH][cfq-cgroups][01/12] Move basic strcture variable to header file Satoshi UCHIDA
2008-11-12 8:24 ` [PATCH][cfq-cgroups][02/12] Introduce "cfq_driver_data" structure Satoshi UCHIDA
2008-11-12 8:25 ` [PATCH][cfq-cgroups][03/12] Add cgroup file and modify configure files Satoshi UCHIDA
2008-11-12 8:26 ` [PATCH][cfq-cgroups][04/12] Register or unregister "cfq-cgroups" module Satoshi UCHIDA
2008-11-12 8:26 ` [PATCH][cfq-cgroups][05/12] Introduce cgroups structure with ioprio entry Satoshi UCHIDA
2008-11-12 8:27 ` [PATCH][cfq-cgroups][06/12] Add siblings tree control for driver data(cfq_driver_data) Satoshi UCHIDA
2008-11-12 8:28 ` [PATCH][cfq-cgroups][07/12] Add sibling tree control for group data(cfq_cgroup) Satoshi UCHIDA
2008-11-12 8:29 ` [PATCH][cfq-cgroups][08/12] Interface to new cfq data structure in cfq_cgroup module Satoshi UCHIDA
2008-11-12 8:29 ` [PATCH][cfq-cgroups][09/12] Develop service tree control Satoshi UCHIDA
2008-11-12 8:30 ` [PATCH][cfq-cgroups][10/12] Introduce request control for two layer Satoshi UCHIDA
2008-11-12 8:31 ` Satoshi UCHIDA [this message]
2008-11-12 8:31 ` [PATCH][cfq-cgroups][12/12] Interface for parameter of cfq driver data Satoshi UCHIDA
2008-11-12 8:37 ` [PATCH][cfq-cgroups][Option 1] Introduce a think time valid entry Satoshi UCHIDA
2008-11-12 8:37 ` [PATCH][cfq-cgroups][Option 2] Introduce ioprio class for top layer Satoshi UCHIDA
2008-11-12 8:57 ` [PATCH][RFC][12+2][v3] A expanded CFQ scheduler for cgroups Peter Zijlstra
2008-11-12 9:22 ` Satoshi UCHIDA
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='001801c944a1$011b0060$03510120$@jp.nec.com' \
--to=s-uchida@ap.jp.nec.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=containers@lists.linux-foundation.org \
--cc=fernando@oss.ntt.co.jp \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
--cc=ngupta@google.com \
--cc=righi.andrea@gmail.com \
--cc=ryov@valinux.co.jp \
--cc=tom-sugawara@ap.jp.nec.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=vtaras@openvz.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
all inboxes | Powered by JetHome®