From 2bc522878d6c6b9a17cce0dd6bae32147864c23b Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Tue, 12 Feb 2019 17:30:26 -0800 Subject: [PATCH] Suppress error log when timerslack_ns write fails for already dead process lmkd uses set_sched_priority to expedite killing of its victims and this sometimes results in timerslack_ns writes for an process which is already dead. These messages are detrimental during troubleshooting and do not indicate a real problem, therefore need to be suppressed. Bug: 124324891 Test: lmkd_unit_test Change-Id: I5bc071b47d386c279dd9a56eee51dba7797f4520 Signed-off-by: Suren Baghdasaryan --- libprocessgroup/task_profiles.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libprocessgroup/task_profiles.cpp b/libprocessgroup/task_profiles.cpp index 447852d7f..b69103c15 100644 --- a/libprocessgroup/task_profiles.cpp +++ b/libprocessgroup/task_profiles.cpp @@ -90,6 +90,10 @@ bool SetTimerSlackAction::ExecuteForTask(int tid) const { if (sys_supports_timerslack) { auto file = StringPrintf("/proc/%d/timerslack_ns", tid); if (!WriteStringToFile(std::to_string(slack_), file)) { + if (errno == ENOENT) { + // This happens when process is already dead + return true; + } PLOG(ERROR) << "set_timerslack_ns write failed"; } }