From 69a40e98d01bab5c520723f35398c29f739d226f Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Fri, 14 Sep 2018 20:20:54 -0700 Subject: systemc: Change how the scheduler orders processes. The Accellera implementation looks like it does all the methods, then all the threads, and then loops back and tries again, and there are even comments in the code that suggests that. What it actually does, however, is runs all the methods, then runs a single thread if one is waiting, and then starts over. The effect is that the scheduler will run any methods first, then run threads until a method might have become ready, and then repeat. This will actually result in more mixing of threads and methods, more context switches, and worse performance, but it makes the regressions pass more. Change-Id: I7cb0485e26eed79204ff2a3c3ded27b973e0b7b0 Reviewed-on: https://gem5-review.googlesource.com/c/12808 Reviewed-by: Gabe Black Maintainer: Gabe Black --- src/systemc/core/scheduler.hh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/systemc/core/scheduler.hh') diff --git a/src/systemc/core/scheduler.hh b/src/systemc/core/scheduler.hh index 33515ea43..ad1467ea1 100644 --- a/src/systemc/core/scheduler.hh +++ b/src/systemc/core/scheduler.hh @@ -194,16 +194,16 @@ class Scheduler void runNow(Process *p) { - // This function may put a process on the wrong list, ie a method on - // the process list or vice versa. That's fine since that's just a - // performance optimization, and the important thing here is how the - // processes are ordered. + // This function may put a process on the wrong list, ie a thread + // the method list. That's fine since that's just a performance + // optimization, and the important thing here is how the processes are + // ordered. // If a process is running, schedule it/us to run again. if (_current) - readyList->pushFirst(_current); + readyListMethods.pushFirst(_current); // Schedule p to run first. - readyList->pushFirst(p); + readyListMethods.pushFirst(p); yield(); } @@ -390,6 +390,13 @@ class Scheduler ScEvents deltas; TimeSlots timeSlots; + Process * + getNextReady() + { + Process *p = readyListMethods.getNext(); + return p ? p : readyListThreads.getNext(); + } + void runReady(); EventWrapper readyEvent; void scheduleReadyEvent(); @@ -441,7 +448,6 @@ class Scheduler ProcessList initList; - ProcessList *readyList; ProcessList readyListMethods; ProcessList readyListThreads; -- cgit v1.2.3