Commit 247d6bf8 by Maxime Chéramy

Modification of the way migrations are handled by the processor.

This fixes the following use case:
at t=x, T migrates from CPU1 to CPU2
at t=x, T finally migrates from CPU2 to CPU1

This was leading to a situation where T was running on both processors.
parent 0778959b
...@@ -11,7 +11,8 @@ ACTIVATE = 2 ...@@ -11,7 +11,8 @@ ACTIVATE = 2
TERMINATE = 3 TERMINATE = 3
TIMER = 4 TIMER = 4
MIGRATE = 5 MIGRATE = 5
SPEED = 6 PREEMPT = 6
SPEED = 7
class ProcInfo(object): class ProcInfo(object):
...@@ -91,8 +92,7 @@ class Processor(Process): ...@@ -91,8 +92,7 @@ class Processor(Process):
self._running = None self._running = None
def preempt(self): def preempt(self):
if MIGRATE not in self._evts: self._evts.append((PREEMPT,))
self._evts.append(("preempt",))
self._running = None self._running = None
def timer(self, timer): def timer(self, timer):
...@@ -197,9 +197,7 @@ class Processor(Process): ...@@ -197,9 +197,7 @@ class Processor(Process):
yield hold, self, evt[1].overhead yield hold, self, evt[1].overhead
evt[1].call_handler() evt[1].call_handler()
elif evt[0] == MIGRATE: elif evt[0] == MIGRATE:
self._running = evt[1]
self.monitor.observe(ProcOverheadEvent("Migration")) self.monitor.observe(ProcOverheadEvent("Migration"))
#yield hold, self, self._migration_overhead #overhead migration
elif evt[0] == SPEED: elif evt[0] == SPEED:
self._speed = evt[1] self._speed = evt[1]
elif evt[0] == RESCHED: elif evt[0] == RESCHED:
...@@ -227,6 +225,7 @@ class Processor(Process): ...@@ -227,6 +225,7 @@ class Processor(Process):
# if the job was running somewhere else, stop it. # if the job was running somewhere else, stop it.
if job and job.cpu.running == job: if job and job.cpu.running == job:
job.cpu.evts = [e for e in self._evts if e[0] != MIGRATE]
job.cpu.preempt() job.cpu.preempt()
# Send that job to processor cpu. # Send that job to processor cpu.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment