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