Modifications for Linux v4.0.
authorAnselm Busse <anselm.busse@tu-berlin.de>
Mon, 18 Jan 2016 20:18:36 +0000 (21:18 +0100)
committerAnselm Busse <anselm.busse@tu-berlin.de>
Wed, 20 Jan 2016 10:21:11 +0000 (11:21 +0100)
framework/os/linux/linux_sched.c

index ea94793..bcdd986 100644 (file)
@@ -1685,44 +1685,74 @@ void set_user_nice(struct task_struct *p, long nice)
        return;
 }
 
-/*
- * kernel/sched/core.c:4474
- * This task is about to go to sleep on IO. Increment rq->nr_iowait so
- * that process accounting knows that this is a task in IO wait state.
- */
-void __sched io_schedule(void)
-{
-       struct rq *rq = raw_rq();
 
-       delayacct_blkio_start();
-       atomic_inc(&rq->nr_iowait);
-       blk_flush_plug(current);
-       current->in_iowait = 1;
-       schedule();
-       current->in_iowait = 0;
-       atomic_dec(&rq->nr_iowait);
-       delayacct_blkio_end();
-}
-EXPORT_SYMBOL(io_schedule);
+///*
+// * kernel/sched/core.c:4474
+// * This task is about to go to sleep on IO. Increment rq->nr_iowait so
+// * that process accounting knows that this is a task in IO wait state.
+// */
+//void __sched io_schedule(void)
+//{
+//     struct rq *rq = raw_rq();
+//
+//     delayacct_blkio_start();
+//     atomic_inc(&rq->nr_iowait);
+//     blk_flush_plug(current);
+//     current->in_iowait = 1;
+//     schedule();
+//     current->in_iowait = 0;
+//     atomic_dec(&rq->nr_iowait);
+//     delayacct_blkio_end();
+//}
+//EXPORT_SYMBOL(io_schedule);
 
 /*
- * kernel/sched/core.c:4489
+ * This task is about to go to sleep on IO. Increment rq->nr_iowait so
+ * that process accounting knows that this is a task in IO wait state.
  */
 long __sched io_schedule_timeout(long timeout)
 {
-       struct rq *rq = raw_rq();
+       int old_iowait = current->in_iowait;
+       struct rq *rq;
        long ret;
-
+       
+       current->in_iowait = 1;
+       if (old_iowait)
+               blk_schedule_flush_plug(current);
+       else
+               blk_flush_plug(current);
+       
        delayacct_blkio_start();
+       rq = raw_rq();
        atomic_inc(&rq->nr_iowait);
-       blk_flush_plug(current);
-       current->in_iowait = 1;
        ret = schedule_timeout(timeout);
-       current->in_iowait = 0;
+       current->in_iowait = old_iowait;
        atomic_dec(&rq->nr_iowait);
        delayacct_blkio_end();
+       
        return ret;
 }
+EXPORT_SYMBOL(io_schedule_timeout);
+
+
+///*
+// * kernel/sched/core.c:4489
+// */
+//long __sched io_schedule_timeout(long timeout)
+//{
+//     struct rq *rq = raw_rq();
+//     long ret;
+//
+//     delayacct_blkio_start();
+//     atomic_inc(&rq->nr_iowait);
+//     blk_flush_plug(current);
+//     current->in_iowait = 1;
+//     ret = schedule_timeout(timeout);
+//     current->in_iowait = 0;
+//     atomic_dec(&rq->nr_iowait);
+//     delayacct_blkio_end();
+//     return ret;
+//}
 
 
 /*