[16/60] xen/sched: add id to struct sched_unit
diff mbox series

Message ID 20190528103313.1343-17-jgross@suse.com
State New, archived
Headers show
Series
  • xen: add core scheduling support
Related show

Commit Message

Jürgen Groß May 28, 2019, 10:32 a.m. UTC
Add an identifier to sched_unit. For now it will be the same as the
related vcpu_id.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 xen/common/schedule.c   | 3 ++-
 xen/include/xen/sched.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 61c8e1252f..d1c706186f 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -289,12 +289,13 @@  static struct sched_unit *sched_alloc_unit(struct vcpu *v)
 
     v->sched_unit = unit;
     unit->vcpu = v;
+    unit->unit_id = v->vcpu_id;
     unit->domain = d;
 
     for ( prev_unit = &d->sched_unit_list; *prev_unit;
           prev_unit = &(*prev_unit)->next_in_list )
         if ( (*prev_unit)->next_in_list &&
-             (*prev_unit)->next_in_list->vcpu->vcpu_id > v->vcpu_id )
+             (*prev_unit)->next_in_list->unit_id > unit->unit_id )
             break;
 
     unit->next_in_list = *prev_unit;
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 0b927fdd55..c76b81ebef 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -266,6 +266,7 @@  struct sched_unit {
     void                  *priv;      /* scheduler private data */
     struct sched_unit     *next_in_list;
     struct sched_resource *res;
+    int                    unit_id;
 
     /* Last time when unit has been scheduled out. */
     uint64_t               last_run_time;