Commit 3b18152c authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds
Browse files

[PATCH] CFQ io scheduler updates



- Adjust slice values

- Instead of one async queue, one is defined per priority level. This
  prevents kernel threads (such as reiserfs/x and others) that run at
  higher io priority from conflicting with others. Previously, it was a
  coin toss what io prio the async queue got, it was defined by who
  first set up the queue.

- Let a time slice only begin, when the previous slice is completely
  done. Previously we could be somewhat unfair to a new sync slice, if
  the previous slice was async and had several ios queued. This might
  need a little tweaking if throughput suffers a little due to this,
  allowing perhaps an overlap of a single request or so.

- Optimize the calling of kblockd_schedule_work() by doing it only when
  it is strictly necessary (no requests in driver and work left to do).

- Correct sync vs async logic. A 'normal' process can be purely async as
  well, and a flusher can be purely sync as well. Sync or async is now a
  property of the class defined and requests pending. Previously writers
  could be considered sync, when they were really async.

- Get rid of the bit fields in cfqq and crq, use flags instead.

- Various other cleanups and fixes
Signed-off-by: default avatarJens Axboe <axboe@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3d25f356
......@@ -34,14 +34,15 @@ static int cfq_back_max = 16 * 1024; /* maximum backwards seek, in KiB */
static int cfq_back_penalty = 2; /* penalty of a backwards seek */
static int cfq_slice_sync = HZ / 10;
static int cfq_slice_async = HZ / 50;
static int cfq_slice_async = HZ / 25;
static int cfq_slice_async_rq = 2;
static int cfq_slice_idle = HZ / 50;
static int cfq_slice_idle = HZ / 100;
#define CFQ_IDLE_GRACE (HZ / 10)
#define CFQ_SLICE_SCALE (5)
#define CFQ_KEY_ASYNC (0)
#define CFQ_KEY_ANY (0xffff)
/*
* disable queueing at the driver/hardware level
......@@ -96,7 +97,16 @@ static kmem_cache_t *cfq_ioc_pool;
#define cfq_class_be(cfqq) ((cfqq)->ioprio_class == IOPRIO_CLASS_BE)
#define cfq_class_rt(cfqq) ((cfqq)->ioprio_class == IOPRIO_CLASS_RT)
#define cfq_cfqq_sync(cfqq) ((cfqq)->key != CFQ_KEY_ASYNC)
#define ASYNC (0)
#define SYNC (1)
#define cfq_cfqq_dispatched(cfqq) \
((cfqq)->on_dispatch[ASYNC] + (cfqq)->on_dispatch[SYNC])
#define cfq_cfqq_class_sync(cfqq) ((cfqq)->key != CFQ_KEY_ASYNC)
#define cfq_cfqq_sync(cfqq) \
(cfq_cfqq_class_sync(cfqq) || (cfqq)->on_dispatch[SYNC])
/*
* Per block device queue structure
......@@ -200,28 +210,15 @@ struct cfq_queue {
unsigned long slice_left;
unsigned long service_last;
/* number of requests that have been handed to the driver */
int in_flight;
/* number of requests that are on the dispatch list */
int on_dispatch[2];
/* io prio of this group */
unsigned short ioprio, org_ioprio;
unsigned short ioprio_class, org_ioprio_class;
/* whether queue is on rr (or empty) list */
unsigned on_rr : 1;
/* idle slice, waiting for new request submission */
unsigned wait_request : 1;
/* set when wait_request gets set, reset on first rq alloc */
unsigned must_alloc : 1;
/* only gets one must_alloc per slice */
unsigned must_alloc_slice : 1;
/* idle slice, request added, now waiting to dispatch it */
unsigned must_dispatch : 1;
/* fifo expire per-slice */
unsigned fifo_expire : 1;
unsigned idle_window : 1;
unsigned prio_changed : 1;
/* various state flags, see below */
unsigned int flags;
};
struct cfq_rq {
......@@ -233,15 +230,77 @@ struct cfq_rq {
struct cfq_queue *cfq_queue;
struct cfq_io_context *io_context;
unsigned in_flight : 1;
unsigned accounted : 1;
unsigned is_sync : 1;
unsigned requeued : 1;
unsigned int crq_flags;
};
static struct cfq_queue *cfq_find_cfq_hash(struct cfq_data *, unsigned int);
enum cfqq_state_flags {
CFQ_CFQQ_FLAG_on_rr = 0,
CFQ_CFQQ_FLAG_wait_request,
CFQ_CFQQ_FLAG_must_alloc,
CFQ_CFQQ_FLAG_must_alloc_slice,
CFQ_CFQQ_FLAG_must_dispatch,
CFQ_CFQQ_FLAG_fifo_expire,
CFQ_CFQQ_FLAG_idle_window,
CFQ_CFQQ_FLAG_prio_changed,
CFQ_CFQQ_FLAG_expired,
};
#define CFQ_CFQQ_FNS(name) \
static inline void cfq_mark_cfqq_##name(struct cfq_queue *cfqq) \
{ \
cfqq->flags |= (1 << CFQ_CFQQ_FLAG_##name); \
} \
static inline void cfq_clear_cfqq_##name(struct cfq_queue *cfqq) \
{ \
cfqq->flags &= ~(1 << CFQ_CFQQ_FLAG_##name); \
} \
static inline int cfq_cfqq_##name(const struct cfq_queue *cfqq) \
{ \
return (cfqq->flags & (1 << CFQ_CFQQ_FLAG_##name)) != 0; \
}
CFQ_CFQQ_FNS(on_rr);
CFQ_CFQQ_FNS(wait_request);
CFQ_CFQQ_FNS(must_alloc);
CFQ_CFQQ_FNS(must_alloc_slice);
CFQ_CFQQ_FNS(must_dispatch);
CFQ_CFQQ_FNS(fifo_expire);
CFQ_CFQQ_FNS(idle_window);
CFQ_CFQQ_FNS(prio_changed);
CFQ_CFQQ_FNS(expired);
#undef CFQ_CFQQ_FNS
enum cfq_rq_state_flags {
CFQ_CRQ_FLAG_in_flight = 0,
CFQ_CRQ_FLAG_in_driver,
CFQ_CRQ_FLAG_is_sync,
CFQ_CRQ_FLAG_requeued,
};
#define CFQ_CRQ_FNS(name) \
static inline void cfq_mark_crq_##name(struct cfq_rq *crq) \
{ \
crq->crq_flags |= (1 << CFQ_CRQ_FLAG_##name); \
} \
static inline void cfq_clear_crq_##name(struct cfq_rq *crq) \
{ \
crq->crq_flags &= ~(1 << CFQ_CRQ_FLAG_##name); \
} \
static inline int cfq_crq_##name(const struct cfq_rq *crq) \
{ \
return (crq->crq_flags & (1 << CFQ_CRQ_FLAG_##name)) != 0; \
}
CFQ_CRQ_FNS(in_flight);
CFQ_CRQ_FNS(in_driver);
CFQ_CRQ_FNS(is_sync);
CFQ_CRQ_FNS(requeued);
#undef CFQ_CRQ_FNS
static struct cfq_queue *cfq_find_cfq_hash(struct cfq_data *, unsigned int, unsigned short);
static void cfq_dispatch_sort(request_queue_t *, struct cfq_rq *);
static void cfq_put_cfqd(struct cfq_data *cfqd);
static inline int cfq_pending_requests(struct cfq_data *cfqd);
#define process_sync(tsk) ((tsk)->flags & PF_SYNCWRITE)
......@@ -305,9 +364,9 @@ cfq_choose_req(struct cfq_data *cfqd, struct cfq_rq *crq1, struct cfq_rq *crq2)
return crq2;
if (crq2 == NULL)
return crq1;
if (crq1->requeued)
if (cfq_crq_requeued(crq1))
return crq1;
if (crq2->requeued)
if (cfq_crq_requeued(crq2))
return crq2;
s1 = crq1->request->sector;
......@@ -407,7 +466,7 @@ static void cfq_resort_rr_list(struct cfq_queue *cfqq, int preempted)
struct cfq_data *cfqd = cfqq->cfqd;
struct list_head *list, *entry;
BUG_ON(!cfqq->on_rr);
BUG_ON(!cfq_cfqq_on_rr(cfqq));
list_del(&cfqq->cfq_list);
......@@ -423,7 +482,7 @@ static void cfq_resort_rr_list(struct cfq_queue *cfqq, int preempted)
* has lots of io pending vs one that only generates one
* sporadically or synchronously
*/
if (cfqq->in_flight)
if (cfq_cfqq_dispatched(cfqq))
list = &cfqd->busy_rr;
else
list = &cfqd->rr_list[cfqq->ioprio];
......@@ -461,8 +520,8 @@ static void cfq_resort_rr_list(struct cfq_queue *cfqq, int preempted)
static inline void
cfq_add_cfqq_rr(struct cfq_data *cfqd, struct cfq_queue *cfqq, int requeue)
{
BUG_ON(cfqq->on_rr);
cfqq->on_rr = 1;
BUG_ON(cfq_cfqq_on_rr(cfqq));
cfq_mark_cfqq_on_rr(cfqq);
cfqd->busy_queues++;
cfq_resort_rr_list(cfqq, requeue);
......@@ -471,8 +530,8 @@ cfq_add_cfqq_rr(struct cfq_data *cfqd, struct cfq_queue *cfqq, int requeue)
static inline void
cfq_del_cfqq_rr(struct cfq_data *cfqd, struct cfq_queue *cfqq)
{
BUG_ON(!cfqq->on_rr);
cfqq->on_rr = 0;
BUG_ON(!cfq_cfqq_on_rr(cfqq));
cfq_clear_cfqq_on_rr(cfqq);
list_move(&cfqq->cfq_list, &cfqd->empty_list);
BUG_ON(!cfqd->busy_queues);
......@@ -488,7 +547,7 @@ static inline void cfq_del_crq_rb(struct cfq_rq *crq)
if (ON_RB(&crq->rb_node)) {
struct cfq_data *cfqd = cfqq->cfqd;
const int sync = crq->is_sync;
const int sync = cfq_crq_is_sync(crq);
BUG_ON(!cfqq->queued[sync]);
cfqq->queued[sync]--;
......@@ -498,7 +557,7 @@ static inline void cfq_del_crq_rb(struct cfq_rq *crq)
rb_erase(&crq->rb_node, &cfqq->sort_list);
RB_CLEAR_COLOR(&crq->rb_node);
if (cfqq->on_rr && RB_EMPTY(&cfqq->sort_list))
if (cfq_cfqq_on_rr(cfqq) && RB_EMPTY(&cfqq->sort_list))
cfq_del_cfqq_rr(cfqd, cfqq);
}
}
......@@ -534,7 +593,7 @@ static void cfq_add_crq_rb(struct cfq_rq *crq)
struct cfq_rq *__alias;
crq->rb_key = rq_rb_key(rq);
cfqq->queued[crq->is_sync]++;
cfqq->queued[cfq_crq_is_sync(crq)]++;
/*
* looks a little odd, but the first insert might return an alias.
......@@ -545,8 +604,8 @@ static void cfq_add_crq_rb(struct cfq_rq *crq)
rb_insert_color(&crq->rb_node, &cfqq->sort_list);
if (!cfqq->on_rr)
cfq_add_cfqq_rr(cfqd, cfqq, crq->requeued);
if (!cfq_cfqq_on_rr(cfqq))
cfq_add_cfqq_rr(cfqd, cfqq, cfq_crq_requeued(crq));
/*
* check if this request is a better next-serve candidate
......@@ -559,7 +618,7 @@ cfq_reposition_crq_rb(struct cfq_queue *cfqq, struct cfq_rq *crq)
{
if (ON_RB(&crq->rb_node)) {
rb_erase(&crq->rb_node, &cfqq->sort_list);
cfqq->queued[crq->is_sync]--;
cfqq->queued[cfq_crq_is_sync(crq)]--;
}
cfq_add_crq_rb(crq);
......@@ -568,7 +627,7 @@ cfq_reposition_crq_rb(struct cfq_queue *cfqq, struct cfq_rq *crq)
static struct request *cfq_find_rq_rb(struct cfq_data *cfqd, sector_t sector)
{
struct cfq_queue *cfqq = cfq_find_cfq_hash(cfqd, current->pid);
struct cfq_queue *cfqq = cfq_find_cfq_hash(cfqd, current->pid, CFQ_KEY_ANY);
struct rb_node *n;
if (!cfqq)
......@@ -598,17 +657,19 @@ static void cfq_deactivate_request(request_queue_t *q, struct request *rq)
if (crq) {
struct cfq_queue *cfqq = crq->cfq_queue;
if (crq->accounted) {
crq->accounted = 0;
if (cfq_crq_in_driver(crq)) {
cfq_clear_crq_in_driver(crq);
WARN_ON(!cfqd->rq_in_driver);
cfqd->rq_in_driver--;
}
if (crq->in_flight) {
crq->in_flight = 0;
WARN_ON(!cfqq->in_flight);
cfqq->in_flight--;
if (cfq_crq_in_flight(crq)) {
const int sync = cfq_crq_is_sync(crq);
cfq_clear_crq_in_flight(crq);
WARN_ON(!cfqq->on_dispatch[sync]);
cfqq->on_dispatch[sync]--;
}
crq->requeued = 1;
cfq_mark_crq_requeued(crq);
}
}
......@@ -712,8 +773,9 @@ __cfq_set_active_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq)
cfqq->slice_start = jiffies;
cfqq->slice_end = 0;
cfqq->slice_left = 0;
cfqq->must_alloc_slice = 0;
cfqq->fifo_expire = 0;
cfq_clear_cfqq_must_alloc_slice(cfqq);
cfq_clear_cfqq_fifo_expire(cfqq);
cfq_clear_cfqq_expired(cfqq);
}
cfqd->active_queue = cfqq;
......@@ -776,9 +838,18 @@ static int cfq_get_next_prio_level(struct cfq_data *cfqd)
return prio;
}
static void cfq_set_active_queue(struct cfq_data *cfqd)
static struct cfq_queue *cfq_set_active_queue(struct cfq_data *cfqd)
{
struct cfq_queue *cfqq = NULL;
struct cfq_queue *cfqq;
/*
* if current queue is expired but not done with its requests yet,
* wait for that to happen
*/
if ((cfqq = cfqd->active_queue) != NULL) {
if (cfq_cfqq_expired(cfqq) && cfq_cfqq_dispatched(cfqq))
return NULL;
}
/*
* if current list is non-empty, grab first entry. if it is empty,
......@@ -802,50 +873,66 @@ static void cfq_set_active_queue(struct cfq_data *cfqd)
}
__cfq_set_active_queue(cfqd, cfqq);
return cfqq;
}
/*
* current cfqq expired its slice (or was too idle), select new one
*/
static inline void cfq_slice_expired(struct cfq_data *cfqd, int preempted)
static void
__cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq,
int preempted)
{
struct cfq_queue *cfqq = cfqd->active_queue;
if (cfqq) {
unsigned long now = jiffies;
unsigned long now = jiffies;
if (cfqq->wait_request)
del_timer(&cfqd->idle_slice_timer);
if (cfq_cfqq_wait_request(cfqq))
del_timer(&cfqd->idle_slice_timer);
if (!preempted && !cfqq->in_flight)
cfqq->service_last = now;
if (!preempted && !cfq_cfqq_dispatched(cfqq))
cfqq->service_last = now;
cfqq->must_dispatch = 0;
cfqq->wait_request = 0;
cfq_clear_cfqq_must_dispatch(cfqq);
cfq_clear_cfqq_wait_request(cfqq);
/*
* store what was left of this slice, if the queue idled out
* or was preempted
*/
if (time_after(now, cfqq->slice_end))
cfqq->slice_left = now - cfqq->slice_end;
else
cfqq->slice_left = 0;
/*
* store what was left of this slice, if the queue idled out
* or was preempted
*/
if (time_after(now, cfqq->slice_end))
cfqq->slice_left = now - cfqq->slice_end;
else
cfqq->slice_left = 0;
if (cfqq->on_rr)
cfq_resort_rr_list(cfqq, preempted);
if (cfq_cfqq_on_rr(cfqq))
cfq_resort_rr_list(cfqq, preempted);
if (cfqq == cfqd->active_queue)
cfqd->active_queue = NULL;
if (cfqd->active_cic) {
put_io_context(cfqd->active_cic->ioc);
cfqd->active_cic = NULL;
}
if (cfqd->active_cic) {
put_io_context(cfqd->active_cic->ioc);
cfqd->active_cic = NULL;
}
cfqd->dispatch_slice = 0;
}
static inline void cfq_slice_expired(struct cfq_data *cfqd, int preempted)
{
struct cfq_queue *cfqq = cfqd->active_queue;
if (cfqq) {
/*
* use deferred expiry, if there are requests in progress as
* not to disturb the slice of the next queue
*/
if (cfq_cfqq_dispatched(cfqq))
cfq_mark_cfqq_expired(cfqq);
else
__cfq_slice_expired(cfqd, cfqq, preempted);
}
}
static int cfq_arm_slice_timer(struct cfq_data *cfqd, struct cfq_queue *cfqq)
{
......@@ -857,7 +944,7 @@ static int cfq_arm_slice_timer(struct cfq_data *cfqd, struct cfq_queue *cfqq)
*/
if (!cfqd->cfq_slice_idle)
return 0;
if (!cfqq->idle_window)
if (!cfq_cfqq_idle_window(cfqq))
return 0;
/*
* task has exited, don't wait
......@@ -865,13 +952,13 @@ static int cfq_arm_slice_timer(struct cfq_data *cfqd, struct cfq_queue *cfqq)
if (cfqd->active_cic && !cfqd->active_cic->ioc->task)
return 0;
cfqq->wait_request = 1;
cfqq->must_alloc = 1;
cfq_mark_cfqq_must_dispatch(cfqq);
cfq_mark_cfqq_wait_request(cfqq);
if (!timer_pending(&cfqd->idle_slice_timer)) {
unsigned long slice_left = cfqq->slice_end - 1;
unsigned long slice_left = min(cfqq->slice_end - 1, (unsigned long) cfqd->cfq_slice_idle);
cfqd->idle_slice_timer.expires = min(jiffies + cfqd->cfq_slice_idle, slice_left);
cfqd->idle_slice_timer.expires = jiffies + slice_left;
add_timer(&cfqd->idle_slice_timer);
}
......@@ -901,7 +988,7 @@ static void cfq_dispatch_sort(request_queue_t *q, struct cfq_rq *crq)
break;
if (!blk_fs_request(__rq))
break;
if (__crq->requeued)
if (cfq_crq_requeued(__crq))
break;
if (__rq->sector <= crq->request->sector)
......@@ -920,9 +1007,10 @@ static void cfq_dispatch_sort(request_queue_t *q, struct cfq_rq *crq)
cfq_del_crq_rb(crq);
cfq_remove_merge_hints(q, crq);
crq->in_flight = 1;
crq->requeued = 0;
cfqq->in_flight++;
cfq_mark_crq_in_flight(crq);
cfq_clear_crq_requeued(crq);
cfqq->on_dispatch[cfq_crq_is_sync(crq)]++;
list_add_tail(&crq->request->queuelist, entry);
}
......@@ -935,16 +1023,16 @@ static inline struct cfq_rq *cfq_check_fifo(struct cfq_queue *cfqq)
struct request *rq;
struct cfq_rq *crq;
if (cfqq->fifo_expire)
if (cfq_cfqq_fifo_expire(cfqq))
return NULL;
if (!list_empty(&cfqq->fifo)) {
int fifo = cfq_cfqq_sync(cfqq);
int fifo = cfq_cfqq_class_sync(cfqq);
crq = RQ_DATA(list_entry_fifo(cfqq->fifo.next));
rq = crq->request;
if (time_after(jiffies, rq->start_time + cfqd->cfq_fifo_expire[fifo])) {
cfqq->fifo_expire = 1;
cfq_mark_cfqq_fifo_expire(cfqq);
return crq;
}
}
......@@ -953,7 +1041,9 @@ static inline struct cfq_rq *cfq_check_fifo(struct cfq_queue *cfqq)
}
/*
* Scale schedule slice based on io priority
* Scale schedule slice based on io priority. Use the sync time slice only
* if a queue is marked sync and has sync io queued. A sync queue with async
* io only, should not get full sync slice length.
*/
static inline int
cfq_prio_to_slice(struct cfq_data *cfqd, struct cfq_queue *cfqq)
......@@ -981,6 +1071,16 @@ cfq_prio_to_maxrq(struct cfq_data *cfqd, struct cfq_queue *cfqq)
return 2 * (base_rq + base_rq * (CFQ_PRIO_LISTS - 1 - cfqq->ioprio));
}
/*
* scheduler run of queue, if there are requests pending and no one in the
* driver that will restart queueing
*/
static inline void cfq_schedule_dispatch(struct cfq_data *cfqd)
{
if (!cfqd->rq_in_driver && cfq_pending_requests(cfqd))
kblockd_schedule_work(&cfqd->unplug_work);
}
/*
* get next queue for service
*/
......@@ -993,11 +1093,14 @@ static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd, int force)
if (!cfqq)
goto new_queue;
if (cfq_cfqq_expired(cfqq))
goto new_queue;
/*
* slice has expired
*/
if (!cfqq->must_dispatch && time_after(jiffies, cfqq->slice_end))
goto new_queue;
if (!cfq_cfqq_must_dispatch(cfqq) && time_after(now, cfqq->slice_end))
goto expire;
/*
* if queue has requests, dispatch one. if not, check if
......@@ -1005,17 +1108,18 @@ static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd, int force)
*/
if (!RB_EMPTY(&cfqq->sort_list))
goto keep_queue;
else if (!force && cfq_cfqq_sync(cfqq) &&
else if (!force && cfq_cfqq_class_sync(cfqq) &&
time_before(now, cfqq->slice_end)) {
if (cfq_arm_slice_timer(cfqd, cfqq))
return NULL;
}
new_queue:
expire:
cfq_slice_expired(cfqd, 0);
cfq_set_active_queue(cfqd);
new_queue:
cfqq = cfq_set_active_queue(cfqd);
keep_queue:
return cfqd->active_queue;
return cfqq;
}
static int
......@@ -1083,8 +1187,8 @@ cfq_dispatch_requests(request_queue_t *q, int max_dispatch, int force)
cfqq = cfq_select_queue(cfqd, force);
if (cfqq) {
cfqq->wait_request = 0;
cfqq->must_dispatch = 0;
cfq_clear_cfqq_must_dispatch(cfqq);
cfq_clear_cfqq_wait_request(cfqq);
del_timer(&cfqd->idle_slice_timer);
if (cfq_class_idle(cfqq))
......@@ -1108,10 +1212,10 @@ static inline void cfq_account_dispatch(struct cfq_rq *crq)
* accounted bit is necessary since some drivers will call
* elv_next_request() many times for the same request (eg ide)
*/
if (crq->accounted)
if (cfq_crq_in_driver(crq))
return;
crq->accounted = 1;
cfq_mark_crq_in_driver(crq);
cfqd->rq_in_driver++;
}
......@@ -1121,7 +1225,7 @@ cfq_account_completion(struct cfq_queue *cfqq, struct cfq_rq *crq)
struct cfq_data *cfqd = cfqq->cfqd;
unsigned long now;
if (!crq->accounted)
if (!cfq_crq_in_driver(crq))
return;
now = jiffies;
......@@ -1132,12 +1236,18 @@ cfq_account_completion(struct cfq_queue *cfqq, struct cfq_rq *crq)
if (!cfq_class_idle(cfqq))
cfqd->last_end_request = now;
if (!cfqq->in_flight && cfqq->on_rr) {
cfqq->service_last = now;
cfq_resort_rr_list(cfqq, 0);
if (!cfq_cfqq_dispatched(cfqq)) {
if (cfq_cfqq_on_rr(cfqq)) {
cfqq->service_last = now;
cfq_resort_rr_list(cfqq, 0);
}
if (cfq_cfqq_expired(cfqq)) {
__cfq_slice_expired(cfqd, cfqq, 0);
cfq_schedule_dispatch(cfqd);
}
}
if (crq->is_sync)
if (cfq_crq_is_sync(crq))
crq->io_context->last_end_request = now;
}
......@@ -1153,10 +1263,13 @@ static struct request *cfq_next_request(request_queue_t *q)
crq = RQ_DATA(rq);
if (crq) {
struct cfq_queue *cfqq = crq->cfq_queue;
/*
* if idle window is disabled, allow queue buildup
*/
if (!crq->in_flight && !crq->cfq_queue->idle_window &&
if (!cfq_crq_in_driver(crq) &&
!cfq_cfqq_idle_window(cfqq) &&
cfqd->rq_in_driver >= cfqd->cfq_max_depth)
return NULL;
......@@ -1190,11 +1303,11 @@ static void cfq_put_queue(struct cfq_queue *cfqq)
BUG_ON(rb_first(&cfqq->sort_list));
BUG_ON(cfqq->allocated[READ] + cfqq->allocated[WRITE]);
BUG_ON(cfqq->on_rr);
BUG_ON(cfq_cfqq_on_rr(cfqq));
if (unlikely(cfqd->active_queue == cfqq)) {
cfq_slice_expired(cfqd, 0);
kblockd_schedule_work(&cfqd->unplug_work);
__cfq_slice_expired(cfqd, cfqq, 0);
cfq_schedule_dispatch(cfqd);
}
cfq_put_cfqd(cfqq->cfqd);
......@@ -1208,15 +1321,17 @@ static void cfq_put_queue(struct cfq_queue *cfqq)