[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 12/47] xen/sched: switch struct task_slice from vcpu to sched_unit



Let the schedulers put a sched_unit pointer into struct task_slice
instead of a vcpu pointer.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 xen/common/sched_arinc653.c |  8 ++++----
 xen/common/sched_credit.c   |  4 ++--
 xen/common/sched_credit2.c  |  4 ++--
 xen/common/sched_null.c     | 12 ++++++------
 xen/common/sched_rt.c       |  2 +-
 xen/common/schedule.c       |  4 ++--
 xen/include/xen/sched-if.h  |  6 +++---
 7 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/xen/common/sched_arinc653.c b/xen/common/sched_arinc653.c
index 98cdd7f894..6ae5924980 100644
--- a/xen/common/sched_arinc653.c
+++ b/xen/common/sched_arinc653.c
@@ -554,9 +554,9 @@ a653sched_do_schedule(
 
     /*
      * If there are more domains to run in the current major frame, set
-     * new_task equal to the address of next domain's VCPU structure.
-     * Otherwise, set new_task equal to the address of the idle task's VCPU
-     * structure.
+     * new_task equal to the address of next domain's sched_unit structure.
+     * Otherwise, set new_task equal to the address of the idle task's
+     * sched_unit structure.
      */
     new_task = (sched_index < sched_priv->num_schedule_entries)
         ? sched_priv->schedule[sched_index].vc
@@ -592,7 +592,7 @@ a653sched_do_schedule(
      * of the selected task's VCPU structure.
      */
     ret.time = next_switch_time - now;
-    ret.task = new_task;
+    ret.task = new_task->sched_unit;
     ret.migrated = 0;
 
     BUG_ON(ret.time <= 0);
diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index e430c4efa4..2bf11b0616 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -1993,9 +1993,9 @@ out:
      */
     ret.time = (is_idle_vcpu(snext->vcpu) ?
                 -1 : tslice);
-    ret.task = snext->vcpu;
+    ret.task = snext->vcpu->sched_unit;
 
-    CSCHED_VCPU_CHECK(ret.task);
+    CSCHED_VCPU_CHECK(ret.task->vcpu_list);
     return ret;
 }
 
diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index d82b7a9c75..910440d5d9 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -3637,9 +3637,9 @@ csched2_schedule(
      * Return task to run next...
      */
     ret.time = csched2_runtime(ops, cpu, snext, now);
-    ret.task = snext->vcpu;
+    ret.task = snext->vcpu->sched_unit;
 
-    CSCHED2_VCPU_CHECK(ret.task);
+    CSCHED2_VCPU_CHECK(ret.task->vcpu_list);
     return ret;
 }
 
diff --git a/xen/common/sched_null.c b/xen/common/sched_null.c
index 66f8387f11..63ee1f5439 100644
--- a/xen/common/sched_null.c
+++ b/xen/common/sched_null.c
@@ -819,10 +819,10 @@ static struct task_slice null_schedule(const struct 
scheduler *ops,
     if ( tasklet_work_scheduled )
     {
         trace_var(TRC_SNULL_TASKLET, 1, 0, NULL);
-        ret.task = idle_vcpu[cpu];
+        ret.task = idle_vcpu[cpu]->sched_unit;
     }
     else
-        ret.task = per_cpu(npc, cpu).vcpu;
+        ret.task = per_cpu(npc, cpu).vcpu->sched_unit;
     ret.migrated = 0;
     ret.time = -1;
 
@@ -857,7 +857,7 @@ static struct task_slice null_schedule(const struct 
scheduler *ops,
                 {
                     vcpu_assign(prv, wvc->vcpu, cpu);
                     list_del_init(&wvc->waitq_elem);
-                    ret.task = wvc->vcpu;
+                    ret.task = wvc->vcpu->sched_unit;
                     goto unlock;
                 }
             }
@@ -869,10 +869,10 @@ static struct task_slice null_schedule(const struct 
scheduler *ops,
             cpumask_set_cpu(cpu, &prv->cpus_free);
     }
 
-    if ( unlikely(ret.task == NULL || !vcpu_runnable(ret.task)) )
-        ret.task = idle_vcpu[cpu];
+    if ( unlikely(ret.task == NULL || !unit_runnable(ret.task)) )
+        ret.task = idle_vcpu[cpu]->sched_unit;
 
-    NULL_VCPU_CHECK(ret.task);
+    NULL_VCPU_CHECK(ret.task->vcpu_list);
     return ret;
 }
 
diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c
index cd4223ffd6..8b5ae159b2 100644
--- a/xen/common/sched_rt.c
+++ b/xen/common/sched_rt.c
@@ -1130,7 +1130,7 @@ rt_schedule(const struct scheduler *ops, s_time_t now, 
bool_t tasklet_work_sched
         }
         ret.time = snext->cur_budget; /* invoke the scheduler next time */
     }
-    ret.task = snext->vcpu;
+    ret.task = snext->vcpu->sched_unit;
 
     return ret;
 }
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 152b76ccd6..92a74b731b 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -115,7 +115,7 @@ static struct task_slice sched_idle_schedule(
     const unsigned int cpu = smp_processor_id();
     struct task_slice ret = { .time = -1 };
 
-    ret.task = idle_vcpu[cpu];
+    ret.task = sched_idle_unit(cpu);
     return ret;
 }
 
@@ -1626,7 +1626,7 @@ static void schedule(void)
     sched = this_cpu(scheduler);
     next_slice = sched->do_schedule(sched, now, tasklet_work_scheduled);
 
-    next = next_slice.task;
+    next = next_slice.task->vcpu_list;
 
     sd->curr = next->sched_unit;
 
diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h
index fa3ca51a90..d624b81e53 100644
--- a/xen/include/xen/sched-if.h
+++ b/xen/include/xen/sched-if.h
@@ -192,9 +192,9 @@ static inline spinlock_t *pcpu_schedule_trylock(unsigned 
int cpu)
 }
 
 struct task_slice {
-    struct vcpu *task;
-    s_time_t     time;
-    bool_t       migrated;
+    struct sched_unit *task;
+    s_time_t           time;
+    bool_t             migrated;
 };
 
 struct scheduler {
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.