- Previous thread: [PATCH] net: Keep interface binding when sending packets with ipi_ifindex = 0
- Next thread: [PATCH][RFT] cfq-iosched: drain device before switching to a sync queue
- Threads sorted by date: kernel 200907
o Generally preemption is associated with cross class where if an request
from RT class is pending it will preempt the ongoing BE or IDLE class
request.
o CFQ also does in-class preemtions like a sync request queue preempting the
async request queue. In that case it looks like preempting queue gains
share and it is not fair.
o Implement the similar functionality in bfq so that we can retain the
existing CFQ behavior.
o This patch creates a bypass path so that a queue can be put at the
front of the service tree (add_front, similar to CFQ), so that it will
be selected next to run. That's a different thing that in the process
this queue gains share.
Signed-off-by: Vivek Goyal
---
block/elevator-fq.c | 43 +++++++++++++++++++++++++++++++++++++++----
1 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/block/elevator-fq.c b/block/elevator-fq.c
index a58efdc..7ee4321 100644
--- a/block/elevator-fq.c
+++ b/block/elevator-fq.c
@@ -582,7 +582,7 @@ static struct io_entity *bfq_lookup_next_entity(struct io_sched_data *sd,
* service received if @entity is active) of the queue to calculate its
* timestamps.
*/
-static void __bfq_activate_entity(struct io_entity *entity)
+static void __bfq_activate_entity(struct io_entity *entity, int add_front)
{
struct io_sched_data *sd = entity->sched_data;
struct io_service_tree *st = io_entity_service_tree(entity);
@@ -627,7 +627,42 @@ static void __bfq_activate_entity(struct io_entity *entity)
}
st = __bfq_entity_update_prio(st, entity);
- bfq_calc_finish(entity, entity->budget);
+ /*
+ * This is to emulate cfq like functionality where preemption can
+ * happen with-in same class, like sync queue preempting async queue
+ * May be this is not a very good idea from fairness point of view
+ * as preempting queue gains share. Keeping it for now.
+ */
+ if (add_front) {
+ struct io_entity *next_entity;
+
+ /*
+ * Determine the entity which will be dispatched next
+ * Use sd->next_active once hierarchical patch is applied
+ */
+ next_entity = bfq_lookup_next_entity(sd, 0);
+
+ if (next_entity && next_entity != entity) {
+ struct io_service_tree *new_st;
+ u64 delta;
+
+ new_st = io_entity_service_tree(next_entity);
+
+ /*
+ * At this point, both entities should belong to
+ * same service tree as cross service tree preemption
+ * is automatically taken care by algorithm
+ */
+ BUG_ON(new_st != st);
+ entity->finish = next_entity->finish - 1;
+ delta = bfq_delta(entity->budget, entity->weight);
+ entity->start = entity->finish - delta;
+ if (bfq_gt(entity->start, st->vtime))
+ entity->start = st->vtime;
+ }
+ } else {
+ bfq_calc_finish(entity, entity->budget);
+ }
bfq_active_insert(st, entity);
}
@@ -635,9 +670,9 @@ static void __bfq_activate_entity(struct io_entity *entity)
* bfq_activate_entity - activate an entity.
* @entity: the entity to activate.
*/
-static void bfq_activate_entity(struct io_entity *entity)
+static void bfq_activate_entity(struct io_entity *entity, int add_front)
{
- __bfq_activate_entity(entity);
+ __bfq_activate_entity(entity, add_front);
}
/**
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
from RT class is pending it will preempt the ongoing BE or IDLE class
request.
o CFQ also does in-class preemtions like a sync request queue preempting the
async request queue. In that case it looks like preempting queue gains
share and it is not fair.
o Implement the similar functionality in bfq so that we can retain the
existing CFQ behavior.
o This patch creates a bypass path so that a queue can be put at the
front of the service tree (add_front, similar to CFQ), so that it will
be selected next to run. That's a different thing that in the process
this queue gains share.
Signed-off-by: Vivek Goyal
---
block/elevator-fq.c | 43 +++++++++++++++++++++++++++++++++++++++----
1 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/block/elevator-fq.c b/block/elevator-fq.c
index a58efdc..7ee4321 100644
--- a/block/elevator-fq.c
+++ b/block/elevator-fq.c
@@ -582,7 +582,7 @@ static struct io_entity *bfq_lookup_next_entity(struct io_sched_data *sd,
* service received if @entity is active) of the queue to calculate its
* timestamps.
*/
-static void __bfq_activate_entity(struct io_entity *entity)
+static void __bfq_activate_entity(struct io_entity *entity, int add_front)
{
struct io_sched_data *sd = entity->sched_data;
struct io_service_tree *st = io_entity_service_tree(entity);
@@ -627,7 +627,42 @@ static void __bfq_activate_entity(struct io_entity *entity)
}
st = __bfq_entity_update_prio(st, entity);
- bfq_calc_finish(entity, entity->budget);
+ /*
+ * This is to emulate cfq like functionality where preemption can
+ * happen with-in same class, like sync queue preempting async queue
+ * May be this is not a very good idea from fairness point of view
+ * as preempting queue gains share. Keeping it for now.
+ */
+ if (add_front) {
+ struct io_entity *next_entity;
+
+ /*
+ * Determine the entity which will be dispatched next
+ * Use sd->next_active once hierarchical patch is applied
+ */
+ next_entity = bfq_lookup_next_entity(sd, 0);
+
+ if (next_entity && next_entity != entity) {
+ struct io_service_tree *new_st;
+ u64 delta;
+
+ new_st = io_entity_service_tree(next_entity);
+
+ /*
+ * At this point, both entities should belong to
+ * same service tree as cross service tree preemption
+ * is automatically taken care by algorithm
+ */
+ BUG_ON(new_st != st);
+ entity->finish = next_entity->finish - 1;
+ delta = bfq_delta(entity->budget, entity->weight);
+ entity->start = entity->finish - delta;
+ if (bfq_gt(entity->start, st->vtime))
+ entity->start = st->vtime;
+ }
+ } else {
+ bfq_calc_finish(entity, entity->budget);
+ }
bfq_active_insert(st, entity);
}
@@ -635,9 +670,9 @@ static void __bfq_activate_entity(struct io_entity *entity)
* bfq_activate_entity - activate an entity.
* @entity: the entity to activate.
*/
-static void bfq_activate_entity(struct io_entity *entity)
+static void bfq_activate_entity(struct io_entity *entity, int add_front)
{
- __bfq_activate_entity(entity);
+ __bfq_activate_entity(entity, add_front);
}
/**
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Conversations: [RFC] IO scheduler based IO controller V6
- [RFC] IO scheduler based IO controller V6 by Vivek Goyal on 2009-07-02T20:04:34+00:00
- [PATCH 01/25] io-controller: Documentation by Vivek Goyal on 2009-07-02T20:05:04+00:00
- [PATCH 05/25] io-controller: Charge for time slice based on average disk rate by Vivek Goyal on 2009-07-02T20:05:04+00:00
- [PATCH 14/25] io-controller: Separate out queue and data by Vivek Goyal on 2009-07-02T20:05:05+00:00
- [PATCH 23/25] io-controller: Support per cgroup per device weights and io class by Vivek Goyal on 2009-07-02T20:05:37+00:00
- [PATCH 03/25] io-controller: bfq support of in-class preemption by Vivek Goyal on 2009-07-02T20:05:54+00:00
- [PATCH 22/25] io-controller: Per io group bdi congestion interface by Vivek Goyal on 2009-07-02T20:06:19+00:00
- [PATCH 10/25] io-controller: cfq changes to use hierarchical fair queuing code in elevaotor layer by Vivek Goyal on 2009-07-02T20:06:19+00:00
- [PATCH 16/25] io-controller: noop changes for hierarchical fair queuing by Vivek Goyal on 2009-07-02T20:06:51+00:00
- [PATCH 21/25] io-controller: Per cgroup request descriptor support by Vivek Goyal on 2009-07-02T20:06:51+00:00
- [PATCH 18/25] io-controller: anticipatory changes for hierarchical fair queuing by Vivek Goyal on 2009-07-02T20:07:22+00:00
- [PATCH 19/25] blkio_cgroup patches from Ryo to track async bios. by Vivek Goyal on 2009-07-02T20:07:22+00:00
- [PATCH 15/25] io-conroller: Prepare elevator layer for single queue schedulers by Vivek Goyal on 2009-07-02T20:07:55+00:00
- [PATCH 06/25] io-controller: Modify cfq to make use of flat elevator fair queuing by Vivek Goyal on 2009-07-02T20:08:20+00:00
- [PATCH 02/25] io-controller: Core of the B-WF2Q+ scheduler by Vivek Goyal on 2009-07-02T20:08:39+00:00
- [PATCH 13/25] io-controller: Wait for requests to complete from last queue before new queue is scheduled by Vivek Goyal on 2009-07-02T20:08:39+00:00
- [PATCH 24/25] io-controller: Debug hierarchical IO scheduling by Vivek Goyal on 2009-07-02T20:09:19+00:00
- [PATCH 08/25] io-controller: cgroup related changes for hierarchical group support by Vivek Goyal on 2009-07-02T20:09:19+00:00
- [PATCH 17/25] io-controller: deadline changes for hierarchical fair queuing by Vivek Goyal on 2009-07-02T20:09:45+00:00
- [PATCH 09/25] io-controller: Common hierarchical fair queuing code in elevaotor layer by Vivek Goyal on 2009-07-02T20:11:01+00:00
- [PATCH 11/25] io-controller: Export disk time used and nr sectors dipatched through cgroups by Vivek Goyal on 2009-07-02T20:11:08+00:00
- [PATCH 20/25] io-controller: map async requests to appropriate cgroup by Vivek Goyal on 2009-07-02T20:11:50+00:00
- Re: [PATCH 13/25] io-controller: Wait for requests to complete from last queue before new queue is scheduled by Nauman Rafique on 2009-07-02T20:12:01+00:00
- [PATCH 12/25] io-controller: idle for sometime on sync queue before expiring it by Vivek Goyal on 2009-07-02T20:12:18+00:00
- Re: [PATCH 09/25] io-controller: Common hierarchical fair queuing code in elevaotor layer by Gui Jianfeng on 2009-07-06T02:47:16+00:00
- Re: [PATCH 11/25] io-controller: Export disk time used and nr sectors dipatched through cgroups by Gui Jianfeng on 2009-07-08T02:17:54+00:00
- Re: [PATCH 21/25] io-controller: Per cgroup request descriptor support by Gui Jianfeng on 2009-07-08T03:28:26+00:00
- Re: [RFC] IO scheduler based IO controller V6 by Balbir Singh on 2009-07-08T03:56:43+00:00
- [PATCH] io-controller: implement per group request allocation limitation by Gui Jianfeng on 2009-07-10T01:57:27+00:00
- Re: [PATCH 21/25] io-controller: Per cgroup request descriptor support by Gui Jianfeng on 2009-07-21T05:39:05+00:00
- Re: [PATCH 21/25] io-controller: Per cgroup request descriptor support by Nauman Rafique on 2009-07-21T05:55:51+00:00
- Re: [RFC] IO scheduler based IO controller V6 by Gui Jianfeng on 2009-07-27T02:12:20+00:00
Related Threads
- Monitoring server - oracle
- Runtime load python modules from memory - python
- [python-win32] adodbapi upgrade - python
- copying a static table - mysql
- [PATCH] printk: fix new kernel-doc warnings - kernel
- HDD LED pulsing/flashing every second - any cure? - ubuntu
- [grails-user] Grails Runtime Exception - MissingMethodException - grails
- [PATCH 3/4] kernel32/path: Fix last error in SearchPathA/W with tests - wine
- [PATCH 2/5] wined3d: Focus the focus window. - wine
- [Hendrix] problem - firefox
- [PATCH] [REGRESSION] fix compilation of omap1_bl - kernel