Skip to contentSkip to conversation

Avoid race in schedule() when switching schedulers

PATCH In review Juergen Gross 2 participants 2 messages Sep 13, 2011 – Sep 14, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Avoid race in schedule() when switching schedulers

Selecting the scheduler to call must be done under lock. Otherwise a race might occur when switching schedulers in a cpupool

Signed-off-by [email protected]
1 file changed, 2 insertions(+), 1 deletion(-)

xen/common/schedule.c | 3 ++-

# HG changeset patch
# User Juergen Gross <[email protected]> # Date 1315910154 -7200
# Node ID 86f2a3a45ecbcc49aba88d06bf13bbcaf5a9b89b # Parent 64aab9a077ea937b31fd678b02f755139b924184 Avoid race in schedule() when switching schedulers

Selecting the scheduler to call must be done under lock. Otherwise a race might occur when switching schedulers in a cpupool

Signed-off-by [email protected]
xen/common/schedule.c +2 -1
diff -r 64aab9a077ea -r 86f2a3a45ecb xen/common/schedule.c
@@ -1107,7 +1107,7 @@ static void schedule(void)
 {
     struct vcpu          *prev = current, *next = NULL;
     s_time_t              now = NOW();
-    struct scheduler     *sched = this_cpu(scheduler);
+    struct scheduler     *sched;
     unsigned long        *tasklet_work = &this_cpu(tasklet_work_to_do);
     bool_t                tasklet_work_scheduled = 0;
     struct schedule_data *sd;
@@ -1141,6 +1141,7 @@ static void schedule(void)
     stop_timer(&sd->s_timer);
     
     /* get policy-specific decision on scheduling... */
+    sched = this_cpu(scheduler);
     next_slice = sched->do_schedule(sched, now, tasklet_work_scheduled);
 
     next = next_slice.task;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Juergen Gross

Selecting the scheduler to call must be done under lock. Otherwise a race might occur when switching schedulers in a cpupool

Signed-off-by [email protected]
1 file changed, 2 insertions(+), 1 deletion(-)

xen/common/schedule.c |    3 ++-

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel