diff options
author | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2018-08-17 10:17:59 +0100 |
---|---|---|
committer | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2018-09-17 22:51:14 +0000 |
commit | 1fdf576ec73f676c1bfa2e2524293deab0f5cd68 (patch) | |
tree | ae2bb610bde92fea7e8fe5f9efe1875aee244dfd /src/mem/qos/QoSPolicy.py | |
parent | 537d6874c89da93d9e415ca135dbe0ec3f132669 (diff) | |
download | gem5-1fdf576ec73f676c1bfa2e2524293deab0f5cd68.tar.xz |
mem: Implement QoS Proportional Fair policy
Providing a configurable fair scheduling policy based on utilization;
utilization is directly proportional to a score which is inversely
proportional to the QoS priority. It is meant to avoid starvation of low
priority packets.
Users can tune the policy by adjusting the weight parameter (weight of
the following formula)
new_score = ((1.0 - weight) * old_score) + (weight * served_bytes)
Change-Id: I7679e234b916c57ebed06cec0ff3cff3cf2aef22
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/12359
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>
Diffstat (limited to 'src/mem/qos/QoSPolicy.py')
-rw-r--r-- | src/mem/qos/QoSPolicy.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mem/qos/QoSPolicy.py b/src/mem/qos/QoSPolicy.py index 9ccd98562..6db04aca1 100644 --- a/src/mem/qos/QoSPolicy.py +++ b/src/mem/qos/QoSPolicy.py @@ -81,3 +81,38 @@ class QoSFixedPriorityPolicy(QoSPolicy): # default fixed priority value for non-listed Masters qos_fixed_prio_default_prio = Param.UInt8(0, "Default priority for non-listed Masters") + +class QoSPropFairPolicy(QoSPolicy): + type = 'QoSPropFairPolicy' + cxx_header = "mem/qos/policy_pf.hh" + cxx_class = 'QoS::PropFairPolicy' + + cxx_exports = [ + PyBindMethod('initMasterName'), + PyBindMethod('initMasterObj'), + ] + + _mscores = None + + def setInitialScore(self, master, score): + if not self._mscores: + self._mscores = [] + + self._mscores.append([master, score]) + + def init(self): + if not self._mscores: + print("Error, use setInitialScore to init masters/scores\n"); + exit(1) + else: + for mprio in self._mscores: + master = mprio[0] + score = mprio[1] + if isinstance(master, basestring): + self.getCCObject().initMasterName( + master, float(score)) + else: + self.getCCObject().initMasterObj( + master.getCCObject(), float(score)) + + weight = Param.Float(0.5, "Pf score weight") |