From: Hwankyu Jhun Date: Thu, 31 Aug 2023 23:01:40 +0000 (+0900) Subject: Set reset on fork flag X-Git-Tag: accepted/tizen/unified/20230905.085511~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=56af157d856415e171aa6eb6d73a2fe6cae4b82f;p=platform%2Fcore%2Fappfw%2Flaunchpad.git Set reset on fork flag The CPU_BOOSTING_RESET_ON_FORK flag is required in order not to unintentionally inherit the CPU boosting to child processes. Change-Id: Ie0573b18d1e595f7d59e0cc3e76c8784fbceffd4 Signed-off-by: Hwankyu Jhun --- diff --git a/src/launchpad-process-pool/launchpad.cc b/src/launchpad-process-pool/launchpad.cc index 672bc989..c1f0f9b9 100644 --- a/src/launchpad-process-pool/launchpad.cc +++ b/src/launchpad-process-pool/launchpad.cc @@ -208,7 +208,7 @@ Launchpad::Launchpad(int argc, char** argv) level == CPUBoostController::Level::None || level == CPUBoostController::Level::Weak) { CPUBoostController::DoBoost(getpid(), CPUBoostController::Level::Strong, - -1); + -1, true); } g_timeout_add(1000, [](gpointer data) { diff --git a/src/lib/launchpad-common/cpu_boost_controller.cc b/src/lib/launchpad-common/cpu_boost_controller.cc index c72d80ba..615adbd3 100644 --- a/src/lib/launchpad-common/cpu_boost_controller.cc +++ b/src/lib/launchpad-common/cpu_boost_controller.cc @@ -24,7 +24,8 @@ namespace launchpad { -void CPUBoostController::DoBoost(pid_t pid, Level level, int timeout_msec) { +void CPUBoostController::DoBoost(pid_t pid, Level level, int timeout_msec, + bool reset_on_fork) { if (pid < 1) return; @@ -33,10 +34,10 @@ void CPUBoostController::DoBoost(pid_t pid, Level level, int timeout_msec) { .tid = &pid, .tid_count = 1, }; - + int flag = reset_on_fork ? CPU_BOOSTING_RESET_ON_FORK : 0; int ret = resource_set_cpu_boosting(res_pid, static_cast(level), - static_cast(0), timeout_msec); + static_cast(flag), timeout_msec); if (ret != 0) _E("resource_set_cpu_boosting() is failed. error: %d", ret); else diff --git a/src/lib/launchpad-common/cpu_boost_controller.hh b/src/lib/launchpad-common/cpu_boost_controller.hh index ae0df279..715b4bd3 100644 --- a/src/lib/launchpad-common/cpu_boost_controller.hh +++ b/src/lib/launchpad-common/cpu_boost_controller.hh @@ -33,7 +33,8 @@ class EXPORT_API CPUBoostController { Weak, }; - static void DoBoost(pid_t pid, Level level, int timeout_msec); + static void DoBoost(pid_t pid, Level level, int timeout_msec, + bool reset_on_fork = false); static void Clear(pid_t pid); static int GetBoostLevel(pid_t pid, Level* level); };