[15/60] xen/sched: add domain pointer to struct sched_unit
diff mbox series

Message ID 20190528103313.1343-16-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 a pointer to the domain to struct sched_unit in order to avoid
having to dereference the vcpu pointer of struct sched_unit to find
the related domain.

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 78d9108956..61c8e1252f 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -253,7 +253,7 @@  static void sched_spin_unlock_double(spinlock_t *lock1, spinlock_t *lock2,
 static void sched_free_unit(struct sched_unit *unit)
 {
     struct sched_unit *prev_unit;
-    struct domain *d = unit->vcpu->domain;
+    struct domain *d = unit->domain;
 
     if ( d->sched_unit_list == unit )
         d->sched_unit_list = unit->next_in_list;
@@ -289,6 +289,7 @@  static struct sched_unit *sched_alloc_unit(struct vcpu *v)
 
     v->sched_unit = unit;
     unit->vcpu = v;
+    unit->domain = d;
 
     for ( prev_unit = &d->sched_unit_list; *prev_unit;
           prev_unit = &(*prev_unit)->next_in_list )
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 13c99a9194..0b927fdd55 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -261,6 +261,7 @@  struct vcpu
 struct sched_resource;
 
 struct sched_unit {
+    struct domain         *domain;
     struct vcpu           *vcpu;
     void                  *priv;      /* scheduler private data */
     struct sched_unit     *next_in_list;