diff mbox series

[RFC,19/49] xen/sched: add domain pointer to struct sched_item

Message ID 20190329150934.17694-20-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series xen: add core scheduling support | expand

Commit Message

Jürgen Groß March 29, 2019, 3:09 p.m. UTC
Add a pointer to the domain to struct sched_item in order to avoid
having to dereference the vcpu pointer of struct sched_item to find
the related domain.

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

Patch

diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 99660cee67..625d6287c2 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -257,7 +257,7 @@  static void sched_spin_unlock_double(spinlock_t *lock1, spinlock_t *lock2,
 static void sched_free_item(struct sched_item *item)
 {
     struct sched_item *prev_item;
-    struct domain *d = item->vcpu->domain;
+    struct domain *d = item->domain;
 
     if ( d->sched_item_list == item )
         d->sched_item_list = item->next_in_list;
@@ -293,6 +293,7 @@  static struct sched_item *sched_alloc_item(struct vcpu *v)
 
     v->sched_item = item;
     item->vcpu = v;
+    item->domain = d;
 
     for ( prev_item = &d->sched_item_list; *prev_item;
           prev_item = &(*prev_item)->next_in_list )
diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h
index b5cbbbbcb1..9a524014d0 100644
--- a/xen/include/xen/sched-if.h
+++ b/xen/include/xen/sched-if.h
@@ -50,6 +50,7 @@  DECLARE_PER_CPU(struct cpupool *, cpupool);
 DECLARE_PER_CPU(struct sched_resource *, sched_res);
 
 struct sched_item {
+    struct domain         *domain;
     struct vcpu           *vcpu;
     void                  *priv;      /* scheduler private data */
     struct sched_item     *next_in_list;