|
16 | 16 | #include <stdio.h> |
17 | 17 | #include <thread> |
18 | 18 | #include "CoreArbiter/CoreArbiterClient.h" |
19 | | -#include "CoreManager.h" |
20 | | -#include "DefaultCoreManager.h" |
| 19 | +#include "CorePolicy.h" |
| 20 | +#include "DefaultCorePolicy.h" |
21 | 21 | #include "PerfUtils/TimeTrace.h" |
22 | 22 | #include "PerfUtils/Util.h" |
23 | 23 |
|
@@ -207,9 +207,9 @@ std::string coreArbiterSocketPath; |
207 | 207 | CoreArbiterClient* coreArbiter = NULL; |
208 | 208 |
|
209 | 209 | /* |
210 | | - * The CoreManager that Arachne will use. |
| 210 | + * The CorePolicy that Arachne will use. |
211 | 211 | */ |
212 | | -CoreManager* coreManager = NULL; |
| 212 | +CorePolicy* corePolicy = NULL; |
213 | 213 |
|
214 | 214 | // Forward declarations |
215 | 215 | void releaseCore(); |
@@ -284,7 +284,7 @@ threadMain() { |
284 | 284 | *core.localOccupiedAndCount = {0, 0}; |
285 | 285 | *publicPriorityMasks[core.kernelThreadId] = 0; |
286 | 286 | core.privatePriorityMask = 0; |
287 | | - coreManager->coreAvailable(core.kernelThreadId); |
| 287 | + corePolicy->coreAvailable(core.kernelThreadId); |
288 | 288 |
|
289 | 289 | // This marks the point at which new thread creations may begin. |
290 | 290 | numActiveCores++; |
@@ -805,8 +805,8 @@ waitForTermination() { |
805 | 805 | publicPriorityMasks.clear(); |
806 | 806 | PerfUtils::Util::serialize(); |
807 | 807 | coreArbiter->reset(); |
808 | | - delete coreManager; |
809 | | - coreManager = NULL; |
| 808 | + delete corePolicy; |
| 809 | + corePolicy = NULL; |
810 | 810 | initialized = false; |
811 | 811 | } |
812 | 812 |
|
@@ -957,30 +957,30 @@ ThreadContext::initializeStack() { |
957 | 957 | * than the default. This function should be invoked before Arachne::init(), |
958 | 958 | * and the object passed in is owned by Arachne after this function returns. |
959 | 959 | * |
960 | | - * \param arachneCoreManager |
961 | | - * A pointer to the CoreManager that Arachne will use. The CoreManager |
| 960 | + * \param arachneCorePolicy |
| 961 | + * A pointer to the CorePolicy that Arachne will use. The CorePolicy |
962 | 962 | * controls thread allocation to cores. |
963 | 963 | */ |
964 | 964 | void |
965 | | -setCoreManager(CoreManager* arachneCoreManager) { |
| 965 | +setCorePolicy(CorePolicy* arachneCorePolicy) { |
966 | 966 | if (initialized) { |
967 | 967 | ARACHNE_LOG(ERROR, |
968 | 968 | "Attempting to set core policy after Arachne::init has " |
969 | 969 | "already been invoked"); |
970 | 970 | abort(); |
971 | 971 | } |
972 | | - if (coreManager != NULL) |
973 | | - delete coreManager; |
974 | | - coreManager = arachneCoreManager; |
| 972 | + if (corePolicy != NULL) |
| 973 | + delete corePolicy; |
| 974 | + corePolicy = arachneCorePolicy; |
975 | 975 | } |
976 | 976 |
|
977 | 977 | /** |
978 | 978 | * Get the current core policy used by Arachne. This should be used only for |
979 | 979 | * testing. |
980 | 980 | */ |
981 | | -CoreManager* |
982 | | -getCoreManager() { |
983 | | - return coreManager; |
| 981 | +CorePolicy* |
| 982 | +getCorePolicy() { |
| 983 | + return corePolicy; |
984 | 984 | } |
985 | 985 |
|
986 | 986 | /** |
@@ -1044,9 +1044,9 @@ init(int* argcp, const char** argv) { |
1044 | 1044 | maxNumCores, hardwareCoresAvailable); |
1045 | 1045 | } |
1046 | 1046 |
|
1047 | | - if (coreManager == NULL) { |
1048 | | - coreManager = |
1049 | | - new DefaultCoreManager(maxNumCores, !disableLoadEstimation); |
| 1047 | + if (corePolicy == NULL) { |
| 1048 | + corePolicy = |
| 1049 | + new DefaultCorePolicy(maxNumCores, !disableLoadEstimation); |
1050 | 1050 | } |
1051 | 1051 |
|
1052 | 1052 | std::vector<uint32_t> coreRequest({minNumCores, 0, 0, 0, 0, 0, 0, 0}); |
@@ -1420,18 +1420,18 @@ descheduleCore() { |
1420 | 1420 | } |
1421 | 1421 | coreId = ownedCores.back(); |
1422 | 1422 | ownedCores.pop_back(); |
1423 | | - coreManager->coreUnavailable(coreId); |
| 1423 | + corePolicy->coreUnavailable(coreId); |
1424 | 1424 | } |
1425 | 1425 | if (createThreadOnCore(coreId, releaseCore) == NullThread) { |
1426 | | - coreManager->coreAvailable(coreId); |
| 1426 | + corePolicy->coreAvailable(coreId); |
1427 | 1427 | coreChangeActive = false; |
1428 | 1428 | ARACHNE_LOG(WARNING, "Release core thread creation failed to %d!\n", |
1429 | 1429 | coreId); |
1430 | 1430 | } |
1431 | 1431 | } |
1432 | 1432 |
|
1433 | 1433 | /** |
1434 | | - * This function can be called from CoreManagers to increase the number of |
| 1434 | + * This function can be called from CorePolicys to increase the number of |
1435 | 1435 | * cores used by Arachne. |
1436 | 1436 | */ |
1437 | 1437 | void |
@@ -1503,7 +1503,7 @@ checkForArbiterRequest() { |
1503 | 1503 | /** |
1504 | 1504 | * After this function returns, threads may no longer be added to the target |
1505 | 1505 | * core. This function can be invoked from any thread on any core. It is |
1506 | | - * invoked by CoreManagers to block creations when cores transition |
| 1506 | + * invoked by CorePolicys to block creations when cores transition |
1507 | 1507 | * between thread classes. |
1508 | 1508 | */ |
1509 | 1509 | void |
@@ -1576,8 +1576,8 @@ migrateThreadsFromCore() { |
1576 | 1576 | // Choose a victim core that we will pawn our work on. |
1577 | 1577 | if ((blockedOccupiedAndCount.occupied >> i) & 1) { |
1578 | 1578 | int threadClass = core.localThreadContexts[i]->threadClass; |
1579 | | - CoreManager::CoreList outputCores = |
1580 | | - coreManager->getCores(threadClass); |
| 1579 | + CorePolicy::CoreList outputCores = |
| 1580 | + corePolicy->getCores(threadClass); |
1581 | 1581 | if (outputCores.size() == 0) { |
1582 | 1582 | ARACHNE_LOG(ERROR, "No available cores to migrate threads to."); |
1583 | 1583 | exit(1); |
@@ -1749,7 +1749,7 @@ prepareForExclusiveUse(int coreId) { |
1749 | 1749 | * CoreList and return its Id. |
1750 | 1750 | */ |
1751 | 1751 | int |
1752 | | -findAndClaimUnusedCore(CoreManager::CoreList* cores) { |
| 1752 | +findAndClaimUnusedCore(CorePolicy::CoreList* cores) { |
1753 | 1753 | for (uint32_t i = 0; i < cores->size(); i++) { |
1754 | 1754 | int coreId = cores->get(i); |
1755 | 1755 | MaskAndCount slotMap = *occupiedAndCount[coreId]; |
|
0 commit comments