1 |
commit: c996377f0b6842fe8979fc070718d87473d759de |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jul 30 12:56:18 2015 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jul 30 12:56:18 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=c996377f |
7 |
|
8 |
BFQ v7r8 |
9 |
|
10 |
0000_README | 12 +- |
11 |
...oups-kconfig-build-bits-for-BFQ-v7r8-3.10.patch | 6 +- |
12 |
...ntroduce-the-BFQ-v7r8-I-O-sched-for-3.10.patch1 | 196 ++++++++++----------- |
13 |
...arly-Queue-Merge-EQM-to-BFQ-v7r8-for-3.10.patch | 96 +++++----- |
14 |
4 files changed, 147 insertions(+), 163 deletions(-) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index fc173a9..3025db2 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -430,15 +430,15 @@ Patch: 5000_enable-additional-cpu-optimizations-for-gcc.patch |
21 |
From: https://github.com/graysky2/kernel_gcc_patch/ |
22 |
Desc: Kernel patch enables gcc optimizations for additional CPUs. |
23 |
|
24 |
-Patch: 5001_BFQ-1-block-cgroups-kconfig-build-bits-for-v7r7-3.10.patch |
25 |
+Patch: 5001_block-cgroups-kconfig-build-bits-for-BFQ-v7r8-3.10.patch |
26 |
From: http://algo.ing.unimo.it/people/paolo/disk_sched/ |
27 |
-Desc: BFQ v7r7 patch 1 for 3.10: Build, cgroups and kconfig bits |
28 |
+Desc: BFQ v7r8 patch 1 for 3.10: Build, cgroups and kconfig bits |
29 |
|
30 |
-Patch: 5002_BFQ-2-block-introduce-the-v7r7-I-O-sched-for-3.10.patch1 |
31 |
+Patch: 5002_block-introduce-the-BFQ-v7r8-I-O-sched-for-3.10.patch1 |
32 |
From: http://algo.ing.unimo.it/people/paolo/disk_sched/ |
33 |
-Desc: BFQ v7r7 patch 2 for 3.10: BFQ Scheduler |
34 |
+Desc: BFQ v7r8 patch 2 for 3.10: BFQ Scheduler |
35 |
|
36 |
-Patch: 5003_BFQ-3-block-add-Early-Queue-Merge-EQM-v7r7-for-3.10.0.patch |
37 |
+Patch: 5003_block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7r8-for-3.10.patch |
38 |
From: http://algo.ing.unimo.it/people/paolo/disk_sched/ |
39 |
-Desc: BFQ v7r7 patch 3 for 3.10: Early Queue Merge (EQM) |
40 |
+Desc: BFQ v7r8 patch 3 for 3.10: Early Queue Merge (EQM) |
41 |
|
42 |
|
43 |
diff --git a/5001_BFQ-1-block-cgroups-kconfig-build-bits-for-v7r7-3.10.patch b/5001_block-cgroups-kconfig-build-bits-for-BFQ-v7r8-3.10.patch |
44 |
similarity index 97% |
45 |
rename from 5001_BFQ-1-block-cgroups-kconfig-build-bits-for-v7r7-3.10.patch |
46 |
rename to 5001_block-cgroups-kconfig-build-bits-for-BFQ-v7r8-3.10.patch |
47 |
index c76d0e9..1ea37d8 100644 |
48 |
--- a/5001_BFQ-1-block-cgroups-kconfig-build-bits-for-v7r7-3.10.patch |
49 |
+++ b/5001_block-cgroups-kconfig-build-bits-for-BFQ-v7r8-3.10.patch |
50 |
@@ -1,7 +1,7 @@ |
51 |
-From d8a4dc281659c63154708bfd1a66c7ad0fdd2f09 Mon Sep 17 00:00:00 2001 |
52 |
+From dca9e130a9596b036b6ef352e41054f9adce64bd Mon Sep 17 00:00:00 2001 |
53 |
From: Arianna Avanzini <avanzini.arianna@×××××.com> |
54 |
Date: Mon, 27 Jan 2014 23:50:08 +0100 |
55 |
-Subject: [PATCH 1/3] block: cgroups, kconfig, build bits for BFQ-v7r7-3.10 |
56 |
+Subject: [PATCH 1/3] block: cgroups, kconfig, build bits for BFQ-v7r8-3.10 |
57 |
|
58 |
Update Kconfig.iosched and do the related Makefile changes to include |
59 |
kernel configuration options for BFQ. Also add the bfqio controller |
60 |
@@ -99,5 +99,5 @@ index 6e7ec64..e5e6b0d 100644 |
61 |
+ |
62 |
+/* */ |
63 |
-- |
64 |
-2.1.3 |
65 |
+2.1.4 |
66 |
|
67 |
|
68 |
diff --git a/5002_BFQ-2-block-introduce-the-v7r7-I-O-sched-for-3.10.patch1 b/5002_block-introduce-the-BFQ-v7r8-I-O-sched-for-3.10.patch1 |
69 |
similarity index 98% |
70 |
rename from 5002_BFQ-2-block-introduce-the-v7r7-I-O-sched-for-3.10.patch1 |
71 |
rename to 5002_block-introduce-the-BFQ-v7r8-I-O-sched-for-3.10.patch1 |
72 |
index 07fd62f..49bf09c 100644 |
73 |
--- a/5002_BFQ-2-block-introduce-the-v7r7-I-O-sched-for-3.10.patch1 |
74 |
+++ b/5002_block-introduce-the-BFQ-v7r8-I-O-sched-for-3.10.patch1 |
75 |
@@ -1,9 +1,9 @@ |
76 |
-From db537b3062665d5442c516b31d396e61dc4c145c Mon Sep 17 00:00:00 2001 |
77 |
+From b8461d2a63e08357aa8111cbcb87a51d61b68c61 Mon Sep 17 00:00:00 2001 |
78 |
From: Paolo Valente <paolo.valente@×××××××.it> |
79 |
Date: Thu, 9 May 2013 19:10:02 +0200 |
80 |
-Subject: [PATCH 2/3] block: introduce the BFQ-v7r7 I/O sched for 3.10 |
81 |
+Subject: [PATCH 2/3] block: introduce the BFQ-v7r8 I/O sched for 3.10 |
82 |
|
83 |
-Add the BFQ-v7r7 I/O scheduler to 3.10. |
84 |
+Add the BFQ-v7r8 I/O scheduler to 3.10. |
85 |
The general structure is borrowed from CFQ, as much of the code for |
86 |
handling I/O contexts Over time, several useful features have been |
87 |
ported from CFQ as well (details in the changelog in README.BFQ). A |
88 |
@@ -58,10 +58,10 @@ Signed-off-by: Arianna Avanzini <avanzini.arianna@×××××.com> |
89 |
--- |
90 |
block/bfq-cgroup.c | 913 ++++++++++++ |
91 |
block/bfq-ioc.c | 36 + |
92 |
- block/bfq-iosched.c | 3890 +++++++++++++++++++++++++++++++++++++++++++++++++++ |
93 |
- block/bfq-sched.c | 1214 ++++++++++++++++ |
94 |
- block/bfq.h | 773 ++++++++++ |
95 |
- 5 files changed, 6826 insertions(+) |
96 |
+ block/bfq-iosched.c | 3886 +++++++++++++++++++++++++++++++++++++++++++++++++++ |
97 |
+ block/bfq-sched.c | 1208 ++++++++++++++++ |
98 |
+ block/bfq.h | 769 ++++++++++ |
99 |
+ 5 files changed, 6812 insertions(+) |
100 |
create mode 100644 block/bfq-cgroup.c |
101 |
create mode 100644 block/bfq-ioc.c |
102 |
create mode 100644 block/bfq-iosched.c |
103 |
@@ -1031,10 +1031,10 @@ index 0000000..7f6b000 |
104 |
+} |
105 |
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c |
106 |
new file mode 100644 |
107 |
-index 0000000..9de51e3 |
108 |
+index 0000000..729f3e4 |
109 |
--- /dev/null |
110 |
+++ b/block/bfq-iosched.c |
111 |
-@@ -0,0 +1,3890 @@ |
112 |
+@@ -0,0 +1,3886 @@ |
113 |
+/* |
114 |
+ * Budget Fair Queueing (BFQ) disk scheduler. |
115 |
+ * |
116 |
@@ -1107,9 +1107,6 @@ index 0000000..9de51e3 |
117 |
+#include "bfq.h" |
118 |
+#include "blk.h" |
119 |
+ |
120 |
-+/* Max number of dispatches in one round of service. */ |
121 |
-+static const int bfq_quantum = 4; |
122 |
-+ |
123 |
+/* Expiration time of sync (0) and async (1) requests, in jiffies. */ |
124 |
+static const int bfq_fifo_expire[2] = { HZ / 4, HZ / 8 }; |
125 |
+ |
126 |
@@ -1217,6 +1214,20 @@ index 0000000..9de51e3 |
127 |
+#define bfq_sample_valid(samples) ((samples) > 80) |
128 |
+ |
129 |
+/* |
130 |
++ * The following macro groups conditions that need to be evaluated when |
131 |
++ * checking if existing queues and groups form a symmetric scenario |
132 |
++ * and therefore idling can be reduced or disabled for some of the |
133 |
++ * queues. See the comment to the function bfq_bfqq_must_not_expire() |
134 |
++ * for further details. |
135 |
++ */ |
136 |
++#ifdef CONFIG_CGROUP_BFQIO |
137 |
++#define symmetric_scenario (!bfqd->active_numerous_groups && \ |
138 |
++ !bfq_differentiated_weights(bfqd)) |
139 |
++#else |
140 |
++#define symmetric_scenario (!bfq_differentiated_weights(bfqd)) |
141 |
++#endif |
142 |
++ |
143 |
++/* |
144 |
+ * We regard a request as SYNC, if either it's a read or has the SYNC bit |
145 |
+ * set (in which case it could also be a direct WRITE). |
146 |
+ */ |
147 |
@@ -1406,7 +1417,6 @@ index 0000000..9de51e3 |
148 |
+ */ |
149 |
+static inline bool bfq_differentiated_weights(struct bfq_data *bfqd) |
150 |
+{ |
151 |
-+ BUG_ON(!bfqd->hw_tag); |
152 |
+ /* |
153 |
+ * For weights to differ, at least one of the trees must contain |
154 |
+ * at least two nodes. |
155 |
@@ -1443,19 +1453,19 @@ index 0000000..9de51e3 |
156 |
+ struct rb_node **new = &(root->rb_node), *parent = NULL; |
157 |
+ |
158 |
+ /* |
159 |
-+ * Do not insert if: |
160 |
-+ * - the device does not support queueing; |
161 |
-+ * - the entity is already associated with a counter, which happens if: |
162 |
-+ * 1) the entity is associated with a queue, 2) a request arrival |
163 |
-+ * has caused the queue to become both non-weight-raised, and hence |
164 |
-+ * change its weight, and backlogged; in this respect, each |
165 |
-+ * of the two events causes an invocation of this function, |
166 |
-+ * 3) this is the invocation of this function caused by the second |
167 |
-+ * event. This second invocation is actually useless, and we handle |
168 |
-+ * this fact by exiting immediately. More efficient or clearer |
169 |
-+ * solutions might possibly be adopted. |
170 |
++ * Do not insert if the entity is already associated with a |
171 |
++ * counter, which happens if: |
172 |
++ * 1) the entity is associated with a queue, |
173 |
++ * 2) a request arrival has caused the queue to become both |
174 |
++ * non-weight-raised, and hence change its weight, and |
175 |
++ * backlogged; in this respect, each of the two events |
176 |
++ * causes an invocation of this function, |
177 |
++ * 3) this is the invocation of this function caused by the |
178 |
++ * second event. This second invocation is actually useless, |
179 |
++ * and we handle this fact by exiting immediately. More |
180 |
++ * efficient or clearer solutions might possibly be adopted. |
181 |
+ */ |
182 |
-+ if (!bfqd->hw_tag || entity->weight_counter) |
183 |
++ if (entity->weight_counter) |
184 |
+ return; |
185 |
+ |
186 |
+ while (*new) { |
187 |
@@ -1494,14 +1504,6 @@ index 0000000..9de51e3 |
188 |
+ struct bfq_entity *entity, |
189 |
+ struct rb_root *root) |
190 |
+{ |
191 |
-+ /* |
192 |
-+ * Check whether the entity is actually associated with a counter. |
193 |
-+ * In fact, the device may not be considered NCQ-capable for a while, |
194 |
-+ * which implies that no insertion in the weight trees is performed, |
195 |
-+ * after which the device may start to be deemed NCQ-capable, and hence |
196 |
-+ * this function may start to be invoked. This may cause the function |
197 |
-+ * to be invoked for entities that are not associated with any counter. |
198 |
-+ */ |
199 |
+ if (!entity->weight_counter) |
200 |
+ return; |
201 |
+ |
202 |
@@ -2061,7 +2063,8 @@ index 0000000..9de51e3 |
203 |
+ bfq_updated_next_req(bfqd, bfqq); |
204 |
+ } |
205 |
+ |
206 |
-+ list_del_init(&rq->queuelist); |
207 |
++ if (rq->queuelist.prev != &rq->queuelist) |
208 |
++ list_del_init(&rq->queuelist); |
209 |
+ BUG_ON(bfqq->queued[sync] == 0); |
210 |
+ bfqq->queued[sync]--; |
211 |
+ bfqd->queued--; |
212 |
@@ -2136,14 +2139,22 @@ index 0000000..9de51e3 |
213 |
+static void bfq_merged_requests(struct request_queue *q, struct request *rq, |
214 |
+ struct request *next) |
215 |
+{ |
216 |
-+ struct bfq_queue *bfqq = RQ_BFQQ(rq); |
217 |
++ struct bfq_queue *bfqq = RQ_BFQQ(rq), *next_bfqq = RQ_BFQQ(next); |
218 |
+ |
219 |
+ /* |
220 |
-+ * Reposition in fifo if next is older than rq. |
221 |
++ * If next and rq belong to the same bfq_queue and next is older |
222 |
++ * than rq, then reposition rq in the fifo (by substituting next |
223 |
++ * with rq). Otherwise, if next and rq belong to different |
224 |
++ * bfq_queues, never reposition rq: in fact, we would have to |
225 |
++ * reposition it with respect to next's position in its own fifo, |
226 |
++ * which would most certainly be too expensive with respect to |
227 |
++ * the benefits. |
228 |
+ */ |
229 |
-+ if (!list_empty(&rq->queuelist) && !list_empty(&next->queuelist) && |
230 |
++ if (bfqq == next_bfqq && |
231 |
++ !list_empty(&rq->queuelist) && !list_empty(&next->queuelist) && |
232 |
+ time_before(rq_fifo_time(next), rq_fifo_time(rq))) { |
233 |
-+ list_move(&rq->queuelist, &next->queuelist); |
234 |
++ list_del_init(&rq->queuelist); |
235 |
++ list_replace_init(&next->queuelist, &rq->queuelist); |
236 |
+ rq_set_fifo_time(rq, rq_fifo_time(next)); |
237 |
+ } |
238 |
+ |
239 |
@@ -2421,14 +2432,16 @@ index 0000000..9de51e3 |
240 |
+ */ |
241 |
+ sl = bfqd->bfq_slice_idle; |
242 |
+ /* |
243 |
-+ * Unless the queue is being weight-raised, grant only minimum idle |
244 |
-+ * time if the queue either has been seeky for long enough or has |
245 |
-+ * already proved to be constantly seeky. |
246 |
++ * Unless the queue is being weight-raised or the scenario is |
247 |
++ * asymmetric, grant only minimum idle time if the queue either |
248 |
++ * has been seeky for long enough or has already proved to be |
249 |
++ * constantly seeky. |
250 |
+ */ |
251 |
+ if (bfq_sample_valid(bfqq->seek_samples) && |
252 |
+ ((BFQQ_SEEKY(bfqq) && bfqq->entity.service > |
253 |
+ bfq_max_budget(bfqq->bfqd) / 8) || |
254 |
-+ bfq_bfqq_constantly_seeky(bfqq)) && bfqq->wr_coeff == 1) |
255 |
++ bfq_bfqq_constantly_seeky(bfqq)) && bfqq->wr_coeff == 1 && |
256 |
++ symmetric_scenario) |
257 |
+ sl = min(sl, msecs_to_jiffies(BFQ_MIN_TT)); |
258 |
+ else if (bfqq->wr_coeff > 1) |
259 |
+ sl = sl * 3; |
260 |
@@ -3242,12 +3255,6 @@ index 0000000..9de51e3 |
261 |
+static inline bool bfq_bfqq_must_not_expire(struct bfq_queue *bfqq) |
262 |
+{ |
263 |
+ struct bfq_data *bfqd = bfqq->bfqd; |
264 |
-+#ifdef CONFIG_CGROUP_BFQIO |
265 |
-+#define symmetric_scenario (!bfqd->active_numerous_groups && \ |
266 |
-+ !bfq_differentiated_weights(bfqd)) |
267 |
-+#else |
268 |
-+#define symmetric_scenario (!bfq_differentiated_weights(bfqd)) |
269 |
-+#endif |
270 |
+#define cond_for_seeky_on_ncq_hdd (bfq_bfqq_constantly_seeky(bfqq) && \ |
271 |
+ bfqd->busy_in_flight_queues == \ |
272 |
+ bfqd->const_seeky_busy_in_flight_queues) |
273 |
@@ -3263,13 +3270,12 @@ index 0000000..9de51e3 |
274 |
+ */ |
275 |
+#define cond_for_expiring_non_wr (bfqd->hw_tag && \ |
276 |
+ (bfqd->wr_busy_queues > 0 || \ |
277 |
-+ (symmetric_scenario && \ |
278 |
-+ (blk_queue_nonrot(bfqd->queue) || \ |
279 |
-+ cond_for_seeky_on_ncq_hdd)))) |
280 |
++ (blk_queue_nonrot(bfqd->queue) || \ |
281 |
++ cond_for_seeky_on_ncq_hdd))) |
282 |
+ |
283 |
+ return bfq_bfqq_sync(bfqq) && |
284 |
+ !cond_for_expiring_in_burst && |
285 |
-+ (bfqq->wr_coeff > 1 || |
286 |
++ (bfqq->wr_coeff > 1 || !symmetric_scenario || |
287 |
+ (bfq_bfqq_IO_bound(bfqq) && bfq_bfqq_idle_window(bfqq) && |
288 |
+ !cond_for_expiring_non_wr) |
289 |
+ ); |
290 |
@@ -3367,9 +3373,9 @@ index 0000000..9de51e3 |
291 |
+ } |
292 |
+ |
293 |
+ /* |
294 |
-+ * No requests pending. If the in-service queue still has requests |
295 |
-+ * in flight (possibly waiting for a completion) or is idling for a |
296 |
-+ * new request, then keep it. |
297 |
++ * No requests pending. However, if the in-service queue is idling |
298 |
++ * for a new request, or has requests waiting for a completion and |
299 |
++ * may idle after their completion, then keep it anyway. |
300 |
+ */ |
301 |
+ if (new_bfqq == NULL && (timer_pending(&bfqd->idle_slice_timer) || |
302 |
+ (bfqq->dispatched != 0 && bfq_bfqq_must_not_expire(bfqq)))) { |
303 |
@@ -3572,14 +3578,13 @@ index 0000000..9de51e3 |
304 |
+ if (bfqq == NULL) |
305 |
+ return 0; |
306 |
+ |
307 |
-+ max_dispatch = bfqd->bfq_quantum; |
308 |
+ if (bfq_class_idle(bfqq)) |
309 |
+ max_dispatch = 1; |
310 |
+ |
311 |
+ if (!bfq_bfqq_sync(bfqq)) |
312 |
+ max_dispatch = bfqd->bfq_max_budget_async_rq; |
313 |
+ |
314 |
-+ if (bfqq->dispatched >= max_dispatch) { |
315 |
++ if (!bfq_bfqq_sync(bfqq) && bfqq->dispatched >= max_dispatch) { |
316 |
+ if (bfqd->busy_queues > 1) |
317 |
+ return 0; |
318 |
+ if (bfqq->dispatched >= 4 * max_dispatch) |
319 |
@@ -3595,8 +3600,8 @@ index 0000000..9de51e3 |
320 |
+ if (!bfq_dispatch_request(bfqd, bfqq)) |
321 |
+ return 0; |
322 |
+ |
323 |
-+ bfq_log_bfqq(bfqd, bfqq, "dispatched one request of %d (max_disp %d)", |
324 |
-+ bfqq->pid, max_dispatch); |
325 |
++ bfq_log_bfqq(bfqd, bfqq, "dispatched %s request", |
326 |
++ bfq_bfqq_sync(bfqq) ? "sync" : "async"); |
327 |
+ |
328 |
+ return 1; |
329 |
+} |
330 |
@@ -3701,14 +3706,11 @@ index 0000000..9de51e3 |
331 |
+ * Update the entity prio values; note that the new values will not |
332 |
+ * be used until the next (re)activation. |
333 |
+ */ |
334 |
-+static void bfq_init_prio_data(struct bfq_queue *bfqq, struct bfq_io_cq *bic) |
335 |
++static void bfq_set_next_ioprio_data(struct bfq_queue *bfqq, struct bfq_io_cq *bic) |
336 |
+{ |
337 |
+ struct task_struct *tsk = current; |
338 |
+ int ioprio_class; |
339 |
+ |
340 |
-+ if (!bfq_bfqq_prio_changed(bfqq)) |
341 |
-+ return; |
342 |
-+ |
343 |
+ ioprio_class = IOPRIO_PRIO_CLASS(bic->ioprio); |
344 |
+ switch (ioprio_class) { |
345 |
+ default: |
346 |
@@ -3738,17 +3740,16 @@ index 0000000..9de51e3 |
347 |
+ |
348 |
+ if (bfqq->entity.new_ioprio < 0 || |
349 |
+ bfqq->entity.new_ioprio >= IOPRIO_BE_NR) { |
350 |
-+ printk(KERN_CRIT "bfq_init_prio_data: new_ioprio %d\n", |
351 |
++ printk(KERN_CRIT "bfq_set_next_ioprio_data: new_ioprio %d\n", |
352 |
+ bfqq->entity.new_ioprio); |
353 |
+ BUG(); |
354 |
+ } |
355 |
+ |
356 |
++ bfqq->entity.new_weight = bfq_ioprio_to_weight(bfqq->entity.new_ioprio); |
357 |
+ bfqq->entity.ioprio_changed = 1; |
358 |
-+ |
359 |
-+ bfq_clear_bfqq_prio_changed(bfqq); |
360 |
+} |
361 |
+ |
362 |
-+static void bfq_changed_ioprio(struct bfq_io_cq *bic) |
363 |
++static void bfq_check_ioprio_change(struct bfq_io_cq *bic) |
364 |
+{ |
365 |
+ struct bfq_data *bfqd; |
366 |
+ struct bfq_queue *bfqq, *new_bfqq; |
367 |
@@ -3765,6 +3766,8 @@ index 0000000..9de51e3 |
368 |
+ if (unlikely(bfqd == NULL) || likely(bic->ioprio == ioprio)) |
369 |
+ goto out; |
370 |
+ |
371 |
++ bic->ioprio = ioprio; |
372 |
++ |
373 |
+ bfqq = bic->bfqq[BLK_RW_ASYNC]; |
374 |
+ if (bfqq != NULL) { |
375 |
+ bfqg = container_of(bfqq->entity.sched_data, struct bfq_group, |
376 |
@@ -3774,7 +3777,7 @@ index 0000000..9de51e3 |
377 |
+ if (new_bfqq != NULL) { |
378 |
+ bic->bfqq[BLK_RW_ASYNC] = new_bfqq; |
379 |
+ bfq_log_bfqq(bfqd, bfqq, |
380 |
-+ "changed_ioprio: bfqq %p %d", |
381 |
++ "check_ioprio_change: bfqq %p %d", |
382 |
+ bfqq, atomic_read(&bfqq->ref)); |
383 |
+ bfq_put_queue(bfqq); |
384 |
+ } |
385 |
@@ -3782,16 +3785,14 @@ index 0000000..9de51e3 |
386 |
+ |
387 |
+ bfqq = bic->bfqq[BLK_RW_SYNC]; |
388 |
+ if (bfqq != NULL) |
389 |
-+ bfq_mark_bfqq_prio_changed(bfqq); |
390 |
-+ |
391 |
-+ bic->ioprio = ioprio; |
392 |
++ bfq_set_next_ioprio_data(bfqq, bic); |
393 |
+ |
394 |
+out: |
395 |
+ bfq_put_bfqd_unlock(bfqd, &flags); |
396 |
+} |
397 |
+ |
398 |
+static void bfq_init_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
399 |
-+ pid_t pid, int is_sync) |
400 |
++ struct bfq_io_cq *bic, pid_t pid, int is_sync) |
401 |
+{ |
402 |
+ RB_CLEAR_NODE(&bfqq->entity.rb_node); |
403 |
+ INIT_LIST_HEAD(&bfqq->fifo); |
404 |
@@ -3800,7 +3801,8 @@ index 0000000..9de51e3 |
405 |
+ atomic_set(&bfqq->ref, 0); |
406 |
+ bfqq->bfqd = bfqd; |
407 |
+ |
408 |
-+ bfq_mark_bfqq_prio_changed(bfqq); |
409 |
++ if (bic) |
410 |
++ bfq_set_next_ioprio_data(bfqq, bic); |
411 |
+ |
412 |
+ if (is_sync) { |
413 |
+ if (!bfq_class_idle(bfqq)) |
414 |
@@ -3858,8 +3860,8 @@ index 0000000..9de51e3 |
415 |
+ } |
416 |
+ |
417 |
+ if (bfqq != NULL) { |
418 |
-+ bfq_init_bfqq(bfqd, bfqq, current->pid, is_sync); |
419 |
-+ bfq_init_prio_data(bfqq, bic); |
420 |
++ bfq_init_bfqq(bfqd, bfqq, bic, current->pid, |
421 |
++ is_sync); |
422 |
+ bfq_init_entity(&bfqq->entity, bfqg); |
423 |
+ bfq_log_bfqq(bfqd, bfqq, "allocated"); |
424 |
+ } else { |
425 |
@@ -4097,7 +4099,6 @@ index 0000000..9de51e3 |
426 |
+ struct bfq_queue *bfqq = RQ_BFQQ(rq); |
427 |
+ |
428 |
+ assert_spin_locked(bfqd->queue->queue_lock); |
429 |
-+ bfq_init_prio_data(bfqq, RQ_BIC(rq)); |
430 |
+ |
431 |
+ bfq_add_request(rq); |
432 |
+ |
433 |
@@ -4234,11 +4235,8 @@ index 0000000..9de51e3 |
434 |
+ return ELV_MQUEUE_MAY; |
435 |
+ |
436 |
+ bfqq = bic_to_bfqq(bic, rw_is_sync(rw)); |
437 |
-+ if (bfqq != NULL) { |
438 |
-+ bfq_init_prio_data(bfqq, bic); |
439 |
-+ |
440 |
++ if (bfqq != NULL) |
441 |
+ return __bfq_may_queue(bfqq); |
442 |
-+ } |
443 |
+ |
444 |
+ return ELV_MQUEUE_MAY; |
445 |
+} |
446 |
@@ -4316,7 +4314,7 @@ index 0000000..9de51e3 |
447 |
+ |
448 |
+ might_sleep_if(gfp_mask & __GFP_WAIT); |
449 |
+ |
450 |
-+ bfq_changed_ioprio(bic); |
451 |
++ bfq_check_ioprio_change(bic); |
452 |
+ |
453 |
+ spin_lock_irqsave(q->queue_lock, flags); |
454 |
+ |
455 |
@@ -4512,10 +4510,12 @@ index 0000000..9de51e3 |
456 |
+ * Grab a permanent reference to it, so that the normal code flow |
457 |
+ * will not attempt to free it. |
458 |
+ */ |
459 |
-+ bfq_init_bfqq(bfqd, &bfqd->oom_bfqq, 1, 0); |
460 |
++ bfq_init_bfqq(bfqd, &bfqd->oom_bfqq, NULL, 1, 0); |
461 |
+ atomic_inc(&bfqd->oom_bfqq.ref); |
462 |
+ bfqd->oom_bfqq.entity.new_ioprio = BFQ_DEFAULT_QUEUE_IOPRIO; |
463 |
+ bfqd->oom_bfqq.entity.new_ioprio_class = IOPRIO_CLASS_BE; |
464 |
++ bfqd->oom_bfqq.entity.new_weight = |
465 |
++ bfq_ioprio_to_weight(bfqd->oom_bfqq.entity.new_ioprio); |
466 |
+ /* |
467 |
+ * Trigger weight initialization, according to ioprio, at the |
468 |
+ * oom_bfqq's first activation. The oom_bfqq's ioprio and ioprio |
469 |
@@ -4556,7 +4556,6 @@ index 0000000..9de51e3 |
470 |
+ |
471 |
+ bfqd->bfq_max_budget = bfq_default_max_budget; |
472 |
+ |
473 |
-+ bfqd->bfq_quantum = bfq_quantum; |
474 |
+ bfqd->bfq_fifo_expire[0] = bfq_fifo_expire[0]; |
475 |
+ bfqd->bfq_fifo_expire[1] = bfq_fifo_expire[1]; |
476 |
+ bfqd->bfq_back_max = bfq_back_max; |
477 |
@@ -4690,7 +4689,6 @@ index 0000000..9de51e3 |
478 |
+ __data = jiffies_to_msecs(__data); \ |
479 |
+ return bfq_var_show(__data, (page)); \ |
480 |
+} |
481 |
-+SHOW_FUNCTION(bfq_quantum_show, bfqd->bfq_quantum, 0); |
482 |
+SHOW_FUNCTION(bfq_fifo_expire_sync_show, bfqd->bfq_fifo_expire[1], 1); |
483 |
+SHOW_FUNCTION(bfq_fifo_expire_async_show, bfqd->bfq_fifo_expire[0], 1); |
484 |
+SHOW_FUNCTION(bfq_back_seek_max_show, bfqd->bfq_back_max, 0); |
485 |
@@ -4727,7 +4725,6 @@ index 0000000..9de51e3 |
486 |
+ *(__PTR) = __data; \ |
487 |
+ return ret; \ |
488 |
+} |
489 |
-+STORE_FUNCTION(bfq_quantum_store, &bfqd->bfq_quantum, 1, INT_MAX, 0); |
490 |
+STORE_FUNCTION(bfq_fifo_expire_sync_store, &bfqd->bfq_fifo_expire[1], 1, |
491 |
+ INT_MAX, 1); |
492 |
+STORE_FUNCTION(bfq_fifo_expire_async_store, &bfqd->bfq_fifo_expire[0], 1, |
493 |
@@ -4828,7 +4825,6 @@ index 0000000..9de51e3 |
494 |
+ __ATTR(name, S_IRUGO|S_IWUSR, bfq_##name##_show, bfq_##name##_store) |
495 |
+ |
496 |
+static struct elv_fs_entry bfq_attrs[] = { |
497 |
-+ BFQ_ATTR(quantum), |
498 |
+ BFQ_ATTR(fifo_expire_sync), |
499 |
+ BFQ_ATTR(fifo_expire_async), |
500 |
+ BFQ_ATTR(back_seek_max), |
501 |
@@ -4909,7 +4905,7 @@ index 0000000..9de51e3 |
502 |
+ device_speed_thresh[1] = (R_fast[1] + R_slow[1]) / 2; |
503 |
+ |
504 |
+ elv_register(&iosched_bfq); |
505 |
-+ pr_info("BFQ I/O-scheduler version: v7r7"); |
506 |
++ pr_info("BFQ I/O-scheduler: v7r8"); |
507 |
+ |
508 |
+ return 0; |
509 |
+} |
510 |
@@ -4927,10 +4923,10 @@ index 0000000..9de51e3 |
511 |
+MODULE_LICENSE("GPL"); |
512 |
diff --git a/block/bfq-sched.c b/block/bfq-sched.c |
513 |
new file mode 100644 |
514 |
-index 0000000..2931563 |
515 |
+index 0000000..c343099 |
516 |
--- /dev/null |
517 |
+++ b/block/bfq-sched.c |
518 |
-@@ -0,0 +1,1214 @@ |
519 |
+@@ -0,0 +1,1208 @@ |
520 |
+/* |
521 |
+ * BFQ: Hierarchical B-WF2Q+ scheduler. |
522 |
+ * |
523 |
@@ -5569,13 +5565,7 @@ index 0000000..2931563 |
524 |
+ entity->orig_weight = entity->new_weight; |
525 |
+ entity->ioprio = |
526 |
+ bfq_weight_to_ioprio(entity->orig_weight); |
527 |
-+ } else if (entity->new_ioprio != entity->ioprio) { |
528 |
-+ entity->ioprio = entity->new_ioprio; |
529 |
-+ entity->orig_weight = |
530 |
-+ bfq_ioprio_to_weight(entity->ioprio); |
531 |
-+ } else |
532 |
-+ entity->new_weight = entity->orig_weight = |
533 |
-+ bfq_ioprio_to_weight(entity->ioprio); |
534 |
++ } |
535 |
+ |
536 |
+ entity->ioprio_class = entity->new_ioprio_class; |
537 |
+ entity->ioprio_changed = 0; |
538 |
@@ -6147,12 +6137,12 @@ index 0000000..2931563 |
539 |
+} |
540 |
diff --git a/block/bfq.h b/block/bfq.h |
541 |
new file mode 100644 |
542 |
-index 0000000..84c7861 |
543 |
+index 0000000..4131293 |
544 |
--- /dev/null |
545 |
+++ b/block/bfq.h |
546 |
-@@ -0,0 +1,773 @@ |
547 |
+@@ -0,0 +1,769 @@ |
548 |
+/* |
549 |
-+ * BFQ-v7r7 for 3.10.0: data structures and common functions prototypes. |
550 |
++ * BFQ-v7r8 for 3.10.0: data structures and common functions prototypes. |
551 |
+ * |
552 |
+ * Based on ideas and code from CFQ: |
553 |
+ * Copyright (C) 2003 Jens Axboe <axboe@××××××.dk> |
554 |
@@ -6538,7 +6528,6 @@ index 0000000..84c7861 |
555 |
+ * @group_list: list of all the bfq_groups active on the device. |
556 |
+ * @active_list: list of all the bfq_queues active on the device. |
557 |
+ * @idle_list: list of all the bfq_queues idle on the device. |
558 |
-+ * @bfq_quantum: max number of requests dispatched per dispatch round. |
559 |
+ * @bfq_fifo_expire: timeout for async/sync requests; when it expires |
560 |
+ * requests are served in fifo order. |
561 |
+ * @bfq_back_penalty: weight of backward seeks wrt forward ones. |
562 |
@@ -6646,7 +6635,6 @@ index 0000000..84c7861 |
563 |
+ struct list_head active_list; |
564 |
+ struct list_head idle_list; |
565 |
+ |
566 |
-+ unsigned int bfq_quantum; |
567 |
+ unsigned int bfq_fifo_expire[2]; |
568 |
+ unsigned int bfq_back_penalty; |
569 |
+ unsigned int bfq_back_max; |
570 |
@@ -6689,7 +6677,6 @@ index 0000000..84c7861 |
571 |
+ BFQ_BFQQ_FLAG_must_alloc, /* must be allowed rq alloc */ |
572 |
+ BFQ_BFQQ_FLAG_fifo_expire, /* FIFO checked in this slice */ |
573 |
+ BFQ_BFQQ_FLAG_idle_window, /* slice idling enabled */ |
574 |
-+ BFQ_BFQQ_FLAG_prio_changed, /* task priority has changed */ |
575 |
+ BFQ_BFQQ_FLAG_sync, /* synchronous queue */ |
576 |
+ BFQ_BFQQ_FLAG_budget_new, /* no completion with this budget */ |
577 |
+ BFQ_BFQQ_FLAG_IO_bound, /* |
578 |
@@ -6732,7 +6719,6 @@ index 0000000..84c7861 |
579 |
+BFQ_BFQQ_FNS(must_alloc); |
580 |
+BFQ_BFQQ_FNS(fifo_expire); |
581 |
+BFQ_BFQQ_FNS(idle_window); |
582 |
-+BFQ_BFQQ_FNS(prio_changed); |
583 |
+BFQ_BFQQ_FNS(sync); |
584 |
+BFQ_BFQQ_FNS(budget_new); |
585 |
+BFQ_BFQQ_FNS(IO_bound); |
586 |
@@ -6912,7 +6898,7 @@ index 0000000..84c7861 |
587 |
+ spin_unlock_irqrestore(bfqd->queue->queue_lock, *flags); |
588 |
+} |
589 |
+ |
590 |
-+static void bfq_changed_ioprio(struct bfq_io_cq *bic); |
591 |
++static void bfq_check_ioprio_change(struct bfq_io_cq *bic); |
592 |
+static void bfq_put_queue(struct bfq_queue *bfqq); |
593 |
+static void bfq_dispatch_insert(struct request_queue *q, struct request *rq); |
594 |
+static struct bfq_queue *bfq_get_queue(struct bfq_data *bfqd, |
595 |
@@ -6925,5 +6911,5 @@ index 0000000..84c7861 |
596 |
+ |
597 |
+#endif /* _BFQ_H */ |
598 |
-- |
599 |
-2.1.3 |
600 |
+2.1.4 |
601 |
|
602 |
|
603 |
diff --git a/5003_BFQ-3-block-add-Early-Queue-Merge-EQM-v7r7-for-3.10.patch1 b/5003_block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7r8-for-3.10.patch |
604 |
similarity index 94% |
605 |
rename from 5003_BFQ-3-block-add-Early-Queue-Merge-EQM-v7r7-for-3.10.patch1 |
606 |
rename to 5003_block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7r8-for-3.10.patch |
607 |
index dab6ad0..207760c 100644 |
608 |
--- a/5003_BFQ-3-block-add-Early-Queue-Merge-EQM-v7r7-for-3.10.patch1 |
609 |
+++ b/5003_block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7r8-for-3.10.patch |
610 |
@@ -1,7 +1,7 @@ |
611 |
-From 7f87efae9622a8be88fa7e7a705ea26a1342ea47 Mon Sep 17 00:00:00 2001 |
612 |
+From 348e2f1ebd9c6af477894304c80798b107f5a94a Mon Sep 17 00:00:00 2001 |
613 |
From: Mauro Andreolini <mauro.andreolini@×××××××.it> |
614 |
-Date: Fri, 19 Dec 2014 20:09:48 +0100 |
615 |
-Subject: [PATCH 3/3] block, bfq: add Early Queue Merge (EQM) to BFQ-v7r7 for |
616 |
+Date: Sat, 6 Jun 2015 23:44:03 +0200 |
617 |
+Subject: [PATCH 3/3] block, bfq: add Early Queue Merge (EQM) to BFQ-v7r8 for |
618 |
3.10.0 |
619 |
|
620 |
A set of processes may happen to perform interleaved reads, i.e.,requests |
621 |
@@ -34,16 +34,16 @@ Signed-off-by: Mauro Andreolini <mauro.andreolini@×××××××.it> |
622 |
Signed-off-by: Arianna Avanzini <avanzini.arianna@×××××.com> |
623 |
Signed-off-by: Paolo Valente <paolo.valente@×××××××.it> |
624 |
--- |
625 |
- block/bfq-iosched.c | 751 +++++++++++++++++++++++++++++++++++++--------------- |
626 |
+ block/bfq-iosched.c | 750 +++++++++++++++++++++++++++++++++++++--------------- |
627 |
block/bfq-sched.c | 28 -- |
628 |
block/bfq.h | 54 +++- |
629 |
- 3 files changed, 581 insertions(+), 252 deletions(-) |
630 |
+ 3 files changed, 580 insertions(+), 252 deletions(-) |
631 |
|
632 |
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c |
633 |
-index 9de51e3..e0d5c63 100644 |
634 |
+index 729f3e4..db1c145 100644 |
635 |
--- a/block/bfq-iosched.c |
636 |
+++ b/block/bfq-iosched.c |
637 |
-@@ -571,6 +571,57 @@ static inline unsigned int bfq_wr_duration(struct bfq_data *bfqd) |
638 |
+@@ -573,6 +573,57 @@ static inline unsigned int bfq_wr_duration(struct bfq_data *bfqd) |
639 |
return dur; |
640 |
} |
641 |
|
642 |
@@ -101,7 +101,7 @@ index 9de51e3..e0d5c63 100644 |
643 |
/* Empty burst list and add just bfqq (see comments to bfq_handle_burst) */ |
644 |
static inline void bfq_reset_burst_list(struct bfq_data *bfqd, |
645 |
struct bfq_queue *bfqq) |
646 |
-@@ -815,7 +866,7 @@ static void bfq_add_request(struct request *rq) |
647 |
+@@ -817,7 +868,7 @@ static void bfq_add_request(struct request *rq) |
648 |
bfq_rq_pos_tree_add(bfqd, bfqq); |
649 |
|
650 |
if (!bfq_bfqq_busy(bfqq)) { |
651 |
@@ -110,7 +110,7 @@ index 9de51e3..e0d5c63 100644 |
652 |
idle_for_long_time = time_is_before_jiffies( |
653 |
bfqq->budget_timeout + |
654 |
bfqd->bfq_wr_min_idle_time); |
655 |
-@@ -839,11 +890,12 @@ static void bfq_add_request(struct request *rq) |
656 |
+@@ -841,11 +892,12 @@ static void bfq_add_request(struct request *rq) |
657 |
bfqd->last_ins_in_burst = jiffies; |
658 |
} |
659 |
|
660 |
@@ -126,7 +126,7 @@ index 9de51e3..e0d5c63 100644 |
661 |
entity->budget = max_t(unsigned long, bfqq->max_budget, |
662 |
bfq_serv_to_charge(next_rq, bfqq)); |
663 |
|
664 |
-@@ -862,11 +914,20 @@ static void bfq_add_request(struct request *rq) |
665 |
+@@ -864,11 +916,20 @@ static void bfq_add_request(struct request *rq) |
666 |
if (!bfqd->low_latency) |
667 |
goto add_bfqq_busy; |
668 |
|
669 |
@@ -150,7 +150,7 @@ index 9de51e3..e0d5c63 100644 |
670 |
bfqq->wr_coeff = bfqd->bfq_wr_coeff; |
671 |
if (interactive) |
672 |
bfqq->wr_cur_max_time = bfq_wr_duration(bfqd); |
673 |
-@@ -880,7 +941,7 @@ static void bfq_add_request(struct request *rq) |
674 |
+@@ -882,7 +943,7 @@ static void bfq_add_request(struct request *rq) |
675 |
} else if (old_wr_coeff > 1) { |
676 |
if (interactive) |
677 |
bfqq->wr_cur_max_time = bfq_wr_duration(bfqd); |
678 |
@@ -159,7 +159,7 @@ index 9de51e3..e0d5c63 100644 |
679 |
(bfqq->wr_cur_max_time == |
680 |
bfqd->bfq_wr_rt_max_time && |
681 |
!soft_rt)) { |
682 |
-@@ -899,18 +960,18 @@ static void bfq_add_request(struct request *rq) |
683 |
+@@ -901,18 +962,18 @@ static void bfq_add_request(struct request *rq) |
684 |
/* |
685 |
* |
686 |
* The remaining weight-raising time is lower |
687 |
@@ -190,7 +190,7 @@ index 9de51e3..e0d5c63 100644 |
688 |
* |
689 |
* In addition, the application is now meeting |
690 |
* the requirements for being deemed soft rt. |
691 |
-@@ -945,6 +1006,7 @@ static void bfq_add_request(struct request *rq) |
692 |
+@@ -947,6 +1008,7 @@ static void bfq_add_request(struct request *rq) |
693 |
bfqd->bfq_wr_rt_max_time; |
694 |
} |
695 |
} |
696 |
@@ -198,7 +198,7 @@ index 9de51e3..e0d5c63 100644 |
697 |
if (old_wr_coeff != bfqq->wr_coeff) |
698 |
entity->ioprio_changed = 1; |
699 |
add_bfqq_busy: |
700 |
-@@ -1156,90 +1218,35 @@ static void bfq_end_wr(struct bfq_data *bfqd) |
701 |
+@@ -1167,90 +1229,35 @@ static void bfq_end_wr(struct bfq_data *bfqd) |
702 |
spin_unlock_irq(bfqd->queue->queue_lock); |
703 |
} |
704 |
|
705 |
@@ -303,7 +303,7 @@ index 9de51e3..e0d5c63 100644 |
706 |
|
707 |
if (RB_EMPTY_ROOT(root)) |
708 |
return NULL; |
709 |
-@@ -1258,7 +1265,7 @@ static struct bfq_queue *bfqq_close(struct bfq_data *bfqd) |
710 |
+@@ -1269,7 +1276,7 @@ static struct bfq_queue *bfqq_close(struct bfq_data *bfqd) |
711 |
* next_request position). |
712 |
*/ |
713 |
__bfqq = rb_entry(parent, struct bfq_queue, pos_node); |
714 |
@@ -312,7 +312,7 @@ index 9de51e3..e0d5c63 100644 |
715 |
return __bfqq; |
716 |
|
717 |
if (blk_rq_pos(__bfqq->next_rq) < sector) |
718 |
-@@ -1269,7 +1276,7 @@ static struct bfq_queue *bfqq_close(struct bfq_data *bfqd) |
719 |
+@@ -1280,7 +1287,7 @@ static struct bfq_queue *bfqq_close(struct bfq_data *bfqd) |
720 |
return NULL; |
721 |
|
722 |
__bfqq = rb_entry(node, struct bfq_queue, pos_node); |
723 |
@@ -321,7 +321,7 @@ index 9de51e3..e0d5c63 100644 |
724 |
return __bfqq; |
725 |
|
726 |
return NULL; |
727 |
-@@ -1278,14 +1285,12 @@ static struct bfq_queue *bfqq_close(struct bfq_data *bfqd) |
728 |
+@@ -1289,14 +1296,12 @@ static struct bfq_queue *bfqq_close(struct bfq_data *bfqd) |
729 |
/* |
730 |
* bfqd - obvious |
731 |
* cur_bfqq - passed in so that we don't decide that the current queue |
732 |
@@ -340,7 +340,7 @@ index 9de51e3..e0d5c63 100644 |
733 |
{ |
734 |
struct bfq_queue *bfqq; |
735 |
|
736 |
-@@ -1305,7 +1310,7 @@ static struct bfq_queue *bfq_close_cooperator(struct bfq_data *bfqd, |
737 |
+@@ -1316,7 +1321,7 @@ static struct bfq_queue *bfq_close_cooperator(struct bfq_data *bfqd, |
738 |
* working closely on the same area of the disk. In that case, |
739 |
* we can group them together and don't waste time idling. |
740 |
*/ |
741 |
@@ -349,7 +349,7 @@ index 9de51e3..e0d5c63 100644 |
742 |
if (bfqq == NULL || bfqq == cur_bfqq) |
743 |
return NULL; |
744 |
|
745 |
-@@ -1332,6 +1337,315 @@ static struct bfq_queue *bfq_close_cooperator(struct bfq_data *bfqd, |
746 |
+@@ -1343,6 +1348,315 @@ static struct bfq_queue *bfq_close_cooperator(struct bfq_data *bfqd, |
747 |
return bfqq; |
748 |
} |
749 |
|
750 |
@@ -665,7 +665,7 @@ index 9de51e3..e0d5c63 100644 |
751 |
/* |
752 |
* If enough samples have been computed, return the current max budget |
753 |
* stored in bfqd, which is dynamically updated according to the |
754 |
-@@ -1475,61 +1789,6 @@ static struct request *bfq_check_fifo(struct bfq_queue *bfqq) |
755 |
+@@ -1488,61 +1802,6 @@ static struct request *bfq_check_fifo(struct bfq_queue *bfqq) |
756 |
return rq; |
757 |
} |
758 |
|
759 |
@@ -727,7 +727,7 @@ index 9de51e3..e0d5c63 100644 |
760 |
static inline unsigned long bfq_bfqq_budget_left(struct bfq_queue *bfqq) |
761 |
{ |
762 |
struct bfq_entity *entity = &bfqq->entity; |
763 |
-@@ -2263,7 +2522,7 @@ static inline bool bfq_bfqq_must_idle(struct bfq_queue *bfqq) |
764 |
+@@ -2269,7 +2528,7 @@ static inline bool bfq_bfqq_must_idle(struct bfq_queue *bfqq) |
765 |
*/ |
766 |
static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd) |
767 |
{ |
768 |
@@ -736,7 +736,7 @@ index 9de51e3..e0d5c63 100644 |
769 |
struct request *next_rq; |
770 |
enum bfqq_expiration reason = BFQ_BFQQ_BUDGET_TIMEOUT; |
771 |
|
772 |
-@@ -2273,17 +2532,6 @@ static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd) |
773 |
+@@ -2279,17 +2538,6 @@ static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd) |
774 |
|
775 |
bfq_log_bfqq(bfqd, bfqq, "select_queue: already in-service queue"); |
776 |
|
777 |
@@ -754,7 +754,7 @@ index 9de51e3..e0d5c63 100644 |
778 |
if (bfq_may_expire_for_budg_timeout(bfqq) && |
779 |
!timer_pending(&bfqd->idle_slice_timer) && |
780 |
!bfq_bfqq_must_idle(bfqq)) |
781 |
-@@ -2322,10 +2570,7 @@ static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd) |
782 |
+@@ -2328,10 +2576,7 @@ static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd) |
783 |
bfq_clear_bfqq_wait_request(bfqq); |
784 |
del_timer(&bfqd->idle_slice_timer); |
785 |
} |
786 |
@@ -766,9 +766,9 @@ index 9de51e3..e0d5c63 100644 |
787 |
} |
788 |
} |
789 |
|
790 |
-@@ -2334,40 +2579,30 @@ static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd) |
791 |
- * in flight (possibly waiting for a completion) or is idling for a |
792 |
- * new request, then keep it. |
793 |
+@@ -2340,40 +2585,30 @@ static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd) |
794 |
+ * for a new request, or has requests waiting for a completion and |
795 |
+ * may idle after their completion, then keep it anyway. |
796 |
*/ |
797 |
- if (new_bfqq == NULL && (timer_pending(&bfqd->idle_slice_timer) || |
798 |
- (bfqq->dispatched != 0 && bfq_bfqq_must_not_expire(bfqq)))) { |
799 |
@@ -814,7 +814,7 @@ index 9de51e3..e0d5c63 100644 |
800 |
jiffies_to_msecs(bfqq->wr_cur_max_time), |
801 |
bfqq->wr_coeff, |
802 |
bfqq->entity.weight, bfqq->entity.orig_weight); |
803 |
-@@ -2376,12 +2611,16 @@ static void bfq_update_wr_data(struct bfq_data *bfqd, |
804 |
+@@ -2382,12 +2617,16 @@ static void bfq_update_wr_data(struct bfq_data *bfqd, |
805 |
entity->orig_weight * bfqq->wr_coeff); |
806 |
if (entity->ioprio_changed) |
807 |
bfq_log_bfqq(bfqd, bfqq, "WARN: pending prio change"); |
808 |
@@ -832,7 +832,7 @@ index 9de51e3..e0d5c63 100644 |
809 |
time_is_before_jiffies(bfqq->last_wr_start_finish + |
810 |
bfqq->wr_cur_max_time)) { |
811 |
bfqq->last_wr_start_finish = jiffies; |
812 |
-@@ -2390,11 +2629,13 @@ static void bfq_update_wr_data(struct bfq_data *bfqd, |
813 |
+@@ -2396,11 +2635,13 @@ static void bfq_update_wr_data(struct bfq_data *bfqd, |
814 |
bfqq->last_wr_start_finish, |
815 |
jiffies_to_msecs(bfqq->wr_cur_max_time)); |
816 |
bfq_bfqq_end_wr(bfqq); |
817 |
@@ -849,7 +849,7 @@ index 9de51e3..e0d5c63 100644 |
818 |
} |
819 |
|
820 |
/* |
821 |
-@@ -2642,6 +2883,25 @@ static inline void bfq_init_icq(struct io_cq *icq) |
822 |
+@@ -2647,6 +2888,25 @@ static inline void bfq_init_icq(struct io_cq *icq) |
823 |
struct bfq_io_cq *bic = icq_to_bic(icq); |
824 |
|
825 |
bic->ttime.last_end_request = jiffies; |
826 |
@@ -875,7 +875,7 @@ index 9de51e3..e0d5c63 100644 |
827 |
} |
828 |
|
829 |
static void bfq_exit_icq(struct io_cq *icq) |
830 |
-@@ -2655,6 +2915,13 @@ static void bfq_exit_icq(struct io_cq *icq) |
831 |
+@@ -2660,6 +2920,13 @@ static void bfq_exit_icq(struct io_cq *icq) |
832 |
} |
833 |
|
834 |
if (bic->bfqq[BLK_RW_SYNC]) { |
835 |
@@ -889,7 +889,7 @@ index 9de51e3..e0d5c63 100644 |
836 |
bfq_exit_bfqq(bfqd, bic->bfqq[BLK_RW_SYNC]); |
837 |
bic->bfqq[BLK_RW_SYNC] = NULL; |
838 |
} |
839 |
-@@ -2950,6 +3217,10 @@ static void bfq_update_idle_window(struct bfq_data *bfqd, |
840 |
+@@ -2952,6 +3219,10 @@ static void bfq_update_idle_window(struct bfq_data *bfqd, |
841 |
if (!bfq_bfqq_sync(bfqq) || bfq_class_idle(bfqq)) |
842 |
return; |
843 |
|
844 |
@@ -900,7 +900,7 @@ index 9de51e3..e0d5c63 100644 |
845 |
enable_idle = bfq_bfqq_idle_window(bfqq); |
846 |
|
847 |
if (atomic_read(&bic->icq.ioc->active_ref) == 0 || |
848 |
-@@ -2997,6 +3268,7 @@ static void bfq_rq_enqueued(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
849 |
+@@ -2999,6 +3270,7 @@ static void bfq_rq_enqueued(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
850 |
if (bfqq->entity.service > bfq_max_budget(bfqd) / 8 || |
851 |
!BFQQ_SEEKY(bfqq)) |
852 |
bfq_update_idle_window(bfqd, bfqq, bic); |
853 |
@@ -908,7 +908,7 @@ index 9de51e3..e0d5c63 100644 |
854 |
|
855 |
bfq_log_bfqq(bfqd, bfqq, |
856 |
"rq_enqueued: idle_window=%d (seeky %d, mean %llu)", |
857 |
-@@ -3057,13 +3329,49 @@ static void bfq_rq_enqueued(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
858 |
+@@ -3059,12 +3331,47 @@ static void bfq_rq_enqueued(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
859 |
static void bfq_insert_request(struct request_queue *q, struct request *rq) |
860 |
{ |
861 |
struct bfq_data *bfqd = q->elevator->elevator_data; |
862 |
@@ -916,7 +916,7 @@ index 9de51e3..e0d5c63 100644 |
863 |
+ struct bfq_queue *bfqq = RQ_BFQQ(rq), *new_bfqq; |
864 |
|
865 |
assert_spin_locked(bfqd->queue->queue_lock); |
866 |
-+ |
867 |
+ |
868 |
+ /* |
869 |
+ * An unplug may trigger a requeue of a request from the device |
870 |
+ * driver: make sure we are in process context while trying to |
871 |
@@ -944,8 +944,6 @@ index 9de51e3..e0d5c63 100644 |
872 |
+ bfq_bfqq_increase_failed_cooperations(bfqq); |
873 |
+ } |
874 |
+ |
875 |
- bfq_init_prio_data(bfqq, RQ_BIC(rq)); |
876 |
- |
877 |
bfq_add_request(rq); |
878 |
|
879 |
+ /* |
880 |
@@ -959,7 +957,7 @@ index 9de51e3..e0d5c63 100644 |
881 |
rq_set_fifo_time(rq, jiffies + bfqd->bfq_fifo_expire[rq_is_sync(rq)]); |
882 |
list_add_tail(&rq->queuelist, &bfqq->fifo); |
883 |
|
884 |
-@@ -3228,18 +3536,6 @@ static void bfq_put_request(struct request *rq) |
885 |
+@@ -3226,18 +3533,6 @@ static void bfq_put_request(struct request *rq) |
886 |
} |
887 |
} |
888 |
|
889 |
@@ -978,7 +976,7 @@ index 9de51e3..e0d5c63 100644 |
890 |
/* |
891 |
* Returns NULL if a new bfqq should be allocated, or the old bfqq if this |
892 |
* was the last process referring to said bfqq. |
893 |
-@@ -3248,6 +3544,9 @@ static struct bfq_queue * |
894 |
+@@ -3246,6 +3541,9 @@ static struct bfq_queue * |
895 |
bfq_split_bfqq(struct bfq_io_cq *bic, struct bfq_queue *bfqq) |
896 |
{ |
897 |
bfq_log_bfqq(bfqq->bfqd, bfqq, "splitting queue"); |
898 |
@@ -988,7 +986,7 @@ index 9de51e3..e0d5c63 100644 |
899 |
if (bfqq_process_refs(bfqq) == 1) { |
900 |
bfqq->pid = current->pid; |
901 |
bfq_clear_bfqq_coop(bfqq); |
902 |
-@@ -3276,6 +3575,7 @@ static int bfq_set_request(struct request_queue *q, struct request *rq, |
903 |
+@@ -3274,6 +3572,7 @@ static int bfq_set_request(struct request_queue *q, struct request *rq, |
904 |
struct bfq_queue *bfqq; |
905 |
struct bfq_group *bfqg; |
906 |
unsigned long flags; |
907 |
@@ -996,7 +994,7 @@ index 9de51e3..e0d5c63 100644 |
908 |
|
909 |
might_sleep_if(gfp_mask & __GFP_WAIT); |
910 |
|
911 |
-@@ -3293,25 +3593,26 @@ new_queue: |
912 |
+@@ -3291,25 +3590,26 @@ new_queue: |
913 |
if (bfqq == NULL || bfqq == &bfqd->oom_bfqq) { |
914 |
bfqq = bfq_get_queue(bfqd, bfqg, is_sync, bic, gfp_mask); |
915 |
bic_set_bfqq(bic, bfqq, is_sync); |
916 |
@@ -1035,7 +1033,7 @@ index 9de51e3..e0d5c63 100644 |
917 |
} |
918 |
|
919 |
bfqq->allocated[rw]++; |
920 |
-@@ -3322,6 +3623,26 @@ new_queue: |
921 |
+@@ -3320,6 +3620,26 @@ new_queue: |
922 |
rq->elv.priv[0] = bic; |
923 |
rq->elv.priv[1] = bfqq; |
924 |
|
925 |
@@ -1063,10 +1061,10 @@ index 9de51e3..e0d5c63 100644 |
926 |
|
927 |
return 0; |
928 |
diff --git a/block/bfq-sched.c b/block/bfq-sched.c |
929 |
-index 2931563..6764a7e 100644 |
930 |
+index c343099..d0890c6 100644 |
931 |
--- a/block/bfq-sched.c |
932 |
+++ b/block/bfq-sched.c |
933 |
-@@ -1091,34 +1091,6 @@ static struct bfq_queue *bfq_get_next_queue(struct bfq_data *bfqd) |
934 |
+@@ -1085,34 +1085,6 @@ static struct bfq_queue *bfq_get_next_queue(struct bfq_data *bfqd) |
935 |
return bfqq; |
936 |
} |
937 |
|
938 |
@@ -1102,7 +1100,7 @@ index 2931563..6764a7e 100644 |
939 |
{ |
940 |
if (bfqd->in_service_bic != NULL) { |
941 |
diff --git a/block/bfq.h b/block/bfq.h |
942 |
-index 84c7861..0a40b4b 100644 |
943 |
+index 4131293..b1e6f82 100644 |
944 |
--- a/block/bfq.h |
945 |
+++ b/block/bfq.h |
946 |
@@ -218,18 +218,21 @@ struct bfq_group; |
947 |
@@ -1184,8 +1182,8 @@ index 84c7861..0a40b4b 100644 |
948 |
}; |
949 |
|
950 |
enum bfq_device_speed { |
951 |
-@@ -539,7 +573,7 @@ enum bfqq_state_flags { |
952 |
- BFQ_BFQQ_FLAG_prio_changed, /* task priority has changed */ |
953 |
+@@ -536,7 +570,7 @@ enum bfqq_state_flags { |
954 |
+ BFQ_BFQQ_FLAG_idle_window, /* slice idling enabled */ |
955 |
BFQ_BFQQ_FLAG_sync, /* synchronous queue */ |
956 |
BFQ_BFQQ_FLAG_budget_new, /* no completion with this budget */ |
957 |
- BFQ_BFQQ_FLAG_IO_bound, /* |
958 |
@@ -1193,7 +1191,7 @@ index 84c7861..0a40b4b 100644 |
959 |
* bfqq has timed-out at least once |
960 |
* having consumed at most 2/10 of |
961 |
* its budget |
962 |
-@@ -552,12 +586,13 @@ enum bfqq_state_flags { |
963 |
+@@ -549,12 +583,13 @@ enum bfqq_state_flags { |
964 |
* bfqq has proved to be slow and |
965 |
* seeky until budget timeout |
966 |
*/ |
967 |
@@ -1209,7 +1207,7 @@ index 84c7861..0a40b4b 100644 |
968 |
}; |
969 |
|
970 |
#define BFQ_BFQQ_FNS(name) \ |
971 |
-@@ -587,6 +622,7 @@ BFQ_BFQQ_FNS(in_large_burst); |
972 |
+@@ -583,6 +618,7 @@ BFQ_BFQQ_FNS(in_large_burst); |
973 |
BFQ_BFQQ_FNS(constantly_seeky); |
974 |
BFQ_BFQQ_FNS(coop); |
975 |
BFQ_BFQQ_FNS(split_coop); |
976 |
@@ -1218,5 +1216,5 @@ index 84c7861..0a40b4b 100644 |
977 |
#undef BFQ_BFQQ_FNS |
978 |
|
979 |
-- |
980 |
-2.1.3 |
981 |
+2.1.4 |