Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172926
b: refs/heads/master
c: a6d44e9
h: refs/heads/master
v: v3
  • Loading branch information
Corrado Zoccolo authored and Jens Axboe committed Oct 28, 2009
1 parent cf64ac6 commit 1332559
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c0324a020e5b351f100569b128715985f1023af8
refs/heads/master: a6d44e982d3734583b3b4e1d36921af8cfd61fc0
34 changes: 31 additions & 3 deletions trunk/block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,34 @@ static struct cfq_queue *cfq_close_cooperator(struct cfq_data *cfqd,
return cfqq;
}

/*
* Determine whether we should enforce idle window for this queue.
*/

static bool cfq_should_idle(struct cfq_data *cfqd, struct cfq_queue *cfqq)
{
enum wl_prio_t prio = cfqq_prio(cfqq);
struct cfq_rb_root *service_tree;

/* We never do for idle class queues. */
if (prio == IDLE_WORKLOAD)
return false;

/* We do for queues that were marked with idle window flag. */
if (cfq_cfqq_idle_window(cfqq))
return true;

/*
* Otherwise, we do only if they are the last ones
* in their service tree.
*/
service_tree = service_tree_for(prio, cfqd);
if (service_tree->count == 0)
return true;

return (service_tree->count == 1 && cfq_rb_first(service_tree) == cfqq);
}

static void cfq_arm_slice_timer(struct cfq_data *cfqd)
{
struct cfq_queue *cfqq = cfqd->active_queue;
Expand All @@ -1180,7 +1208,7 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd)
/*
* idle is disabled, either manually or by past process history
*/
if (!cfqd->cfq_slice_idle || !cfq_cfqq_idle_window(cfqq))
if (!cfqd->cfq_slice_idle || !cfq_should_idle(cfqd, cfqq))
return;

/*
Expand Down Expand Up @@ -1362,7 +1390,7 @@ static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd)
* conditions to happen (or time out) before selecting a new queue.
*/
if (timer_pending(&cfqd->idle_slice_timer) ||
(cfqq->dispatched && cfq_cfqq_idle_window(cfqq))) {
(cfqq->dispatched && cfq_should_idle(cfqd, cfqq))) {
cfqq = NULL;
goto keep_queue;
}
Expand Down Expand Up @@ -1427,7 +1455,7 @@ static bool cfq_may_dispatch(struct cfq_data *cfqd, struct cfq_queue *cfqq)
/*
* Drain async requests before we start sync IO
*/
if (cfq_cfqq_idle_window(cfqq) && cfqd->rq_in_driver[BLK_RW_ASYNC])
if (cfq_should_idle(cfqd, cfqq) && cfqd->rq_in_driver[BLK_RW_ASYNC])
return false;

/*
Expand Down

0 comments on commit 1332559

Please sign in to comment.