Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions contextual-classifier/ContextualClassifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down Expand Up @@ -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
Expand All @@ -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()));
Expand Down
4 changes: 4 additions & 0 deletions contextual-classifier/Include/ContextualClassifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 9 additions & 9 deletions modula/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
1 change: 0 additions & 1 deletion modula/Common/Include/Resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <vector>

#include "DLManager.h"
#include "MemoryPool.h"

/**
* @brief Used to store information regarding Resources / Tunables which need to be
Expand Down
5 changes: 1 addition & 4 deletions resource-tuner/core/Include/ResourceRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@
#include <unordered_map>

#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
Expand Down
3 changes: 3 additions & 0 deletions resource-tuner/core/ResourceRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down