Skip to content

Commit bf57225

Browse files
Jens AxboeJens Axboe
authored andcommitted
[PATCH] cfq-iosched: improve queue preemption
Don't touch the current queues, just make sure that the wanted queue is selected next. Simplifies the logic. Signed-off-by: Jens Axboe <[email protected]>
1 parent dc72ef4 commit bf57225

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

block/cfq-iosched.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,17 +1539,19 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
15391539
*/
15401540
static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq)
15411541
{
1542-
struct cfq_queue *__cfqq, *next;
1543-
1544-
list_for_each_entry_safe(__cfqq, next, &cfqd->cur_rr, cfq_list)
1545-
cfq_resort_rr_list(__cfqq, 1);
1542+
cfq_slice_expired(cfqd, 1);
15461543

15471544
if (!cfqq->slice_left)
15481545
cfqq->slice_left = cfq_prio_to_slice(cfqd, cfqq) / 2;
15491546

1547+
/*
1548+
* Put the new queue at the front of the of the current list,
1549+
* so we know that it will be selected next.
1550+
*/
1551+
BUG_ON(!cfq_cfqq_on_rr(cfqq));
1552+
list_move(&cfqq->cfq_list, &cfqd->cur_rr);
1553+
15501554
cfqq->slice_end = cfqq->slice_left + jiffies;
1551-
cfq_slice_expired(cfqd, 1);
1552-
__cfq_set_active_queue(cfqd, cfqq);
15531555
}
15541556

15551557
/*

0 commit comments

Comments
 (0)