Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: base/threading/platform_thread_posix.cc

Issue 2334533002: base: Move renderer threads to the appropriate cpuset. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/threading/platform_thread_posix.cc
diff --git a/base/threading/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc
index 4f6d3802c3d67ba4734b01026f123344e79023d9..357f800db78a58836da010e76b8df2216973f306 100644
--- a/base/threading/platform_thread_posix.cc
+++ b/base/threading/platform_thread_posix.cc
@@ -25,8 +25,6 @@
#include "build/build_config.h"
#if defined(OS_LINUX)
-#include "base/files/file_util.h"
-#include "base/strings/string_number_conversions.h"
#include <sys/syscall.h>
#endif
@@ -38,11 +36,6 @@ size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes);
namespace {
-#if defined(OS_LINUX)
-const FilePath::CharType kCpusetDirectory[] =
- FILE_PATH_LITERAL("/sys/fs/cgroup/cpuset/chrome");
-#endif
-
struct ThreadParams {
ThreadParams()
: delegate(NULL), joinable(false), priority(ThreadPriority::NORMAL) {}
@@ -254,32 +247,8 @@ void PlatformThread::SetCurrentThreadPriority(ThreadPriority priority) {
NOTIMPLEMENTED();
#else
#if defined(OS_LINUX)
- // Move thread into the appropriate cpuset when chrome cpuset directory
- // exists. Threads with BACKGROUND priority are move to the "non-urgent"
- // cpuset and threads with DISPLAY and REALTIME_AUDIO priority are moved
- // to "urgent" cpuset.
- FilePath cpuset_filepath(kCpusetDirectory);
- switch (priority) {
- case ThreadPriority::NORMAL:
- break;
- case ThreadPriority::BACKGROUND:
- cpuset_filepath = cpuset_filepath.Append(FILE_PATH_LITERAL("non-urgent"));
- break;
- case ThreadPriority::DISPLAY:
- case ThreadPriority::REALTIME_AUDIO:
- cpuset_filepath = cpuset_filepath.Append(FILE_PATH_LITERAL("urgent"));
- break;
- }
- if (DirectoryExists(cpuset_filepath)) {
- FilePath tasks_filepath =
- cpuset_filepath.Append(FILE_PATH_LITERAL("tasks"));
- std::string tid = IntToString(PlatformThread::CurrentId());
- int bytes_written = WriteFile(tasks_filepath, tid.c_str(), tid.size());
- if (bytes_written != static_cast<int>(tid.size())) {
- DVLOG(1) << "Failed to add " << tid << " to " << tasks_filepath.value();
- }
- }
-#endif // defined(OS_LINUX)
+ SetThreadAffinity(PlatformThread::CurrentId(), priority);
+#endif
if (internal::SetCurrentThreadPriorityForPlatform(priority))
return;

Powered by Google App Engine
This is Rietveld 408576698