]> xenbits.xensource.com Git - people/hx242/xen.git/commitdiff
xen/sched: switch struct task_slice from vcpu to sched_unit
authorJuergen Gross <jgross@suse.com>
Fri, 27 Sep 2019 07:00:16 +0000 (09:00 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 27 Sep 2019 13:21:48 +0000 (15:21 +0200)
Let the schedulers put a sched_unit pointer into struct task_slice
instead of a vcpu pointer.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
xen/common/sched_arinc653.c
xen/common/sched_credit.c
xen/common/sched_credit2.c
xen/common/sched_null.c
xen/common/sched_rt.c
xen/common/schedule.c
xen/include/xen/sched-if.h

index 5cf47f5622d2eb7f40c0f6e15694dc02195faeaf..9ff1d7f245f3223eeb6077c6beab06fc2f851fd0 100644 (file)
@@ -560,9 +560,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
@@ -598,7 +598,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);
index 350f9636faa2866bf7146f7b320b17a3e04e2f13..732fd461b5b93cf76df9f4b94ddf23e966c71e8e 100644 (file)
@@ -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;
 }
 
index 7b0872eba53fecf4e020500a1cf770c7a8dd7888..8857c98dd80c27e0b528371c80029e4b2e15ba4f 100644 (file)
@@ -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;
 }
 
index 06acaf9f905d24d77dbf198e6601630a2d4c1b01..3e6f9f72e294f8003610a26289b725d27b04c87e 100644 (file)
@@ -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;
 }
 
index 3fbe8dad8dd12234d2c772654d7981d645e0ca5c..856eae1faa1e0063a7b143adac93c06f1b1c03bf 100644 (file)
@@ -1129,7 +1129,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;
 }
index 6d27c2f4a5556991cb51c3b4a7d9bb24a66d3c4d..157b91c43904455e41048a930f1a2dbea7d9b55e 100644 (file)
@@ -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;
 }
 
@@ -1627,7 +1627,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;
 
index 0587a8d3d2ff5d76decb7dd9e05000aaa15f9782..2b9d50b9fe820bbd93dc8f57a36067a375fc0344 100644 (file)
@@ -226,9 +226,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 {