diff --git a/contextual-classifier/ContextualClassifier.cpp b/contextual-classifier/ContextualClassifier.cpp index 69fccc757..5082631b0 100644 --- a/contextual-classifier/ContextualClassifier.cpp +++ b/contextual-classifier/ContextualClassifier.cpp @@ -259,13 +259,17 @@ void ContextualClassifier::ClassifierMain() { } this->mCurrRestuneHandles.clear(); - // Step 2: + // Step 3: // - Move the process to focused-cgroup, Also involves removing the process // already there from the cgroup. // - Move the "threads" from per-app config to appropriate cgroups this->MoveAppThreadsToCGroup(ev.pid, ev.tgid, comm, FOCUSED_CGROUP_IDENTIFIER); - // Step 3: If the post processing block exists, call it + // Step 4: + // Configure any per-app config specified signals. + this->configureAssociatedAppSignals(ev.pid, ev.tgid, comm); + + // Step 5: If the post processing block exists, call it // It might provide us a more specific sigID or sigType PostProcessingCallback postCb = Extensions::getPostProcessingCallback(comm); @@ -281,7 +285,7 @@ void ContextualClassifier::ClassifierMain() { sigType = postProcessData.mSigType; } - // Step 4: Apply actions, call tuneSignal + // Apply actions, call tuneSignal this->ApplyActions(sigId, sigType, ev.pid, ev.tgid); } } else if(ev.type == CC_APP_CLOSE) { @@ -533,7 +537,19 @@ void ContextualClassifier::MoveAppThreadsToCGroup(pid_t incomingPID, Request::cleanUpRequest(request); } + } catch(const std::exception& e) { + LOGE(CLASSIFIER_TAG, + "Failed to move per-app threads to cgroup, Error: " + std::string(e.what())); + } +} + +void ContextualClassifier::configureAssociatedAppSignals( + pid_t incomingPID, + pid_t incomingTID, + const std::string& comm) { + try { // Configure any associated signal + AppConfig* appConfig = AppConfigs::getInstance()->getAppConfig(comm); if(appConfig != nullptr && appConfig->mSignalCodes != nullptr) { int32_t numSignals = appConfig->mNumSignals; // Go over the list of proc names (comm) and get their pids @@ -556,7 +572,6 @@ void ContextualClassifier::MoveAppThreadsToCGroup(pid_t incomingPID, } } } - } catch(const std::exception& e) { LOGE(CLASSIFIER_TAG, "Failed to move per-app threads to cgroup, Error: " + std::string(e.what())); diff --git a/contextual-classifier/Include/ContextualClassifier.h b/contextual-classifier/Include/ContextualClassifier.h index 2975ea477..bf7fd16d0 100644 --- a/contextual-classifier/Include/ContextualClassifier.h +++ b/contextual-classifier/Include/ContextualClassifier.h @@ -108,6 +108,10 @@ class ContextualClassifier { const std::string& comm, int32_t cgroupIdentifier); + void configureAssociatedAppSignals(pid_t incomingPID, + pid_t incomingTID, + const std::string& comm); + void untuneRequestHelper(int64_t handle); public: diff --git a/modula/CMakeLists.txt b/modula/CMakeLists.txt index 35df882c2..4462c942c 100644 --- a/modula/CMakeLists.txt +++ b/modula/CMakeLists.txt @@ -18,17 +18,17 @@ target_include_directories(UrmAuxUtils PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/CoreMo install(TARGETS UrmAuxUtils LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) # Install Headers -install( - FILES ${CMAKE_CURRENT_SOURCE_DIR}/Common/Include/UrmPlatformAL.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Urm -) - -install( - FILES ${CMAKE_CURRENT_SOURCE_DIR}/Common/Include/Resource.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Urm +set(HEADER_FILES "") +list(APPEND HEADER_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/Common/Include/UrmPlatformAL.h + ${CMAKE_CURRENT_SOURCE_DIR}/Common/Include/Resource.h + ${CMAKE_CURRENT_SOURCE_DIR}/Common/Include/ErrCodes.h + ${CMAKE_CURRENT_SOURCE_DIR}/Common/Include/Utils.h + ${CMAKE_CURRENT_SOURCE_DIR}/Components/Include/Logger.h + ${CMAKE_CURRENT_SOURCE_DIR}/Components/Include/DLManager.h ) install( - FILES ${CMAKE_CURRENT_SOURCE_DIR}/Components/Include/Logger.h + FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Urm ) diff --git a/modula/Common/Include/Resource.h b/modula/Common/Include/Resource.h index ba1c3270e..e6d935b7c 100644 --- a/modula/Common/Include/Resource.h +++ b/modula/Common/Include/Resource.h @@ -8,7 +8,6 @@ #include #include "DLManager.h" -#include "MemoryPool.h" /** * @brief Used to store information regarding Resources / Tunables which need to be diff --git a/resource-tuner/core/Include/ResourceRegistry.h b/resource-tuner/core/Include/ResourceRegistry.h index b984451e2..c1c458f3d 100644 --- a/resource-tuner/core/Include/ResourceRegistry.h +++ b/resource-tuner/core/Include/ResourceRegistry.h @@ -9,13 +9,10 @@ #include #include "UrmPlatformAL.h" -#include "Utils.h" -#include "TargetRegistry.h" #include "Resource.h" -#include "UrmSettings.h" -#include "AuxRoutines.h" #include "Extensions.h" #include "Logger.h" +#include "Utils.h" /** * @struct ResourceApplyType diff --git a/resource-tuner/core/ResourceRegistry.cpp b/resource-tuner/core/ResourceRegistry.cpp index 16a5b1df1..a62b367c2 100644 --- a/resource-tuner/core/ResourceRegistry.cpp +++ b/resource-tuner/core/ResourceRegistry.cpp @@ -2,6 +2,9 @@ // SPDX-License-Identifier: BSD-3-Clause-Clear #include "ResourceRegistry.h" +#include "AuxRoutines.h" +#include "UrmSettings.h" +#include "TargetRegistry.h" static const int32_t unsupportedResoure = -2;