diff options
author | Suren Baghdasaryan <surenb@google.com> | 2019-01-24 06:57:55 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-01-24 06:57:55 +0000 |
commit | 7e15ad7ecb1a627809bb0c6ebe37a289cf5caa1d (patch) | |
tree | e9820a01414ec9f560c227b14214b4c523408625 | |
parent | ed3f1a584a7a157b4baa84f8d3d05806d20f9059 (diff) | |
parent | c4a02d25a96f4fbf29ed92976715accc2256367d (diff) |
Merge changes from topic "revert move sched_policy functions"
* changes:
DO NOT MERGE: Revert "Add libprocessgroup into VNDK"
DO NOT MERGE: Revert "libcutils: Move sched_policy functions into libprocessgroup"
DO NOT MERGE: Revert "Add dependencies on libprocessgroup for sched_policy users"
-rw-r--r-- | healthd/Android.mk | 1 | ||||
-rw-r--r-- | libcutils/Android.bp | 7 | ||||
-rw-r--r-- | libcutils/include/cutils/sched_policy.h | 63 | ||||
-rw-r--r-- | libcutils/sched_policy.cpp (renamed from libprocessgroup/sched_policy.cpp) | 2 | ||||
-rw-r--r-- | libcutils/tests/Android.bp | 1 | ||||
-rw-r--r-- | libprocessgroup/Android.bp | 39 | ||||
-rw-r--r-- | libprocessgroup/include/processgroup/sched_policy.h | 80 | ||||
-rw-r--r-- | libprocessgroup/processgroup.cpp | 2 | ||||
-rw-r--r-- | libutils/Android.bp | 3 | ||||
-rw-r--r-- | libutils/Threads.cpp | 2 | ||||
-rw-r--r-- | lmkd/Android.bp | 1 | ||||
-rw-r--r-- | logcat/Android.bp | 2 | ||||
-rw-r--r-- | logcat/logcat.cpp | 2 | ||||
-rw-r--r-- | logd/Android.bp | 1 | ||||
-rw-r--r-- | logd/main.cpp | 2 |
15 files changed, 70 insertions, 138 deletions
diff --git a/healthd/Android.mk b/healthd/Android.mk index 2127b9603..80bf84ae8 100644 --- a/healthd/Android.mk +++ b/healthd/Android.mk @@ -109,7 +109,6 @@ CHARGER_STATIC_LIBRARIES := \ libbase \ libutils \ libcutils \ - libprocessgroup \ liblog \ libm \ libc \ diff --git a/libcutils/Android.bp b/libcutils/Android.bp index 0dbbc3f2f..4291212a1 100644 --- a/libcutils/Android.bp +++ b/libcutils/Android.bp @@ -66,6 +66,7 @@ cc_library { "load_file.cpp", "native_handle.cpp", "record_stream.cpp", + "sched_policy.cpp", "sockets.cpp", "strdup16to8.cpp", "strdup8to16.cpp", @@ -177,12 +178,8 @@ cc_library { "libbase_headers", "libcutils_headers", "libutils_headers", - "libprocessgroup_headers", - ], - export_header_lib_headers: [ - "libcutils_headers", - "libprocessgroup_headers", ], + export_header_lib_headers: ["libcutils_headers"], local_include_dirs: ["include"], cflags: [ diff --git a/libcutils/include/cutils/sched_policy.h b/libcutils/include/cutils/sched_policy.h index 538ff6b9b..cf91b76f4 100644 --- a/libcutils/include/cutils/sched_policy.h +++ b/libcutils/include/cutils/sched_policy.h @@ -17,10 +17,67 @@ #ifndef __CUTILS_SCHED_POLICY_H #define __CUTILS_SCHED_POLICY_H +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Check if Linux kernel enables CPUSETS feature. + * + * Return value: 1 if Linux kernel CONFIG_CPUSETS=y; 0 otherwise. + */ +extern bool cpusets_enabled(); + /* - * For backwards compatibility only - * New users should include processgroup/sched_policy.h directly + * Check if Linux kernel enables SCHEDTUNE feature (only available in Android + * common kernel or Linaro LSK, not in mainline Linux as of v4.9) + * + * Return value: 1 if Linux kernel CONFIG_CGROUP_SCHEDTUNE=y; 0 otherwise. + */ +extern bool schedboost_enabled(); + +/* Keep in sync with THREAD_GROUP_* in frameworks/base/core/java/android/os/Process.java */ +typedef enum { + SP_DEFAULT = -1, + SP_BACKGROUND = 0, + SP_FOREGROUND = 1, + SP_SYSTEM = 2, // can't be used with set_sched_policy() + SP_AUDIO_APP = 3, + SP_AUDIO_SYS = 4, + SP_TOP_APP = 5, + SP_RT_APP = 6, + SP_RESTRICTED = 7, + SP_CNT, + SP_MAX = SP_CNT - 1, + SP_SYSTEM_DEFAULT = SP_FOREGROUND, +} SchedPolicy; + +extern int set_cpuset_policy(int tid, SchedPolicy policy); + +/* Assign thread tid to the cgroup associated with the specified policy. + * If the thread is a thread group leader, that is it's gettid() == getpid(), + * then the other threads in the same thread group are _not_ affected. + * On platforms which support gettid(), zero tid means current thread. + * Return value: 0 for success, or -errno for error. + */ +extern int set_sched_policy(int tid, SchedPolicy policy); + +/* Return the policy associated with the cgroup of thread tid via policy pointer. + * On platforms which support gettid(), zero tid means current thread. + * Return value: 0 for success, or -1 for error and set errno. + */ +extern int get_sched_policy(int tid, SchedPolicy *policy); + +/* Return a displayable string corresponding to policy. + * Return value: non-NULL NUL-terminated name of unspecified length; + * the caller is responsible for displaying the useful part of the string. */ -#include <processgroup/sched_policy.h> +extern const char *get_sched_policy_name(SchedPolicy policy); + +#ifdef __cplusplus +} +#endif #endif /* __CUTILS_SCHED_POLICY_H */ diff --git a/libprocessgroup/sched_policy.cpp b/libcutils/sched_policy.cpp index f95d7e48f..3fa548f78 100644 --- a/libprocessgroup/sched_policy.cpp +++ b/libcutils/sched_policy.cpp @@ -14,7 +14,7 @@ ** limitations under the License. */ -#include <processgroup/sched_policy.h> +#include <cutils/sched_policy.h> #define LOG_TAG "SchedPolicy" diff --git a/libcutils/tests/Android.bp b/libcutils/tests/Android.bp index 72ae55921..788419038 100644 --- a/libcutils/tests/Android.bp +++ b/libcutils/tests/Android.bp @@ -59,7 +59,6 @@ test_libraries = [ "libcutils", "liblog", "libbase", - "libprocessgroup", ] cc_test { diff --git a/libprocessgroup/Android.bp b/libprocessgroup/Android.bp index d04a79a66..c38279df4 100644 --- a/libprocessgroup/Android.bp +++ b/libprocessgroup/Android.bp @@ -1,45 +1,10 @@ -cc_library_headers { - name: "libprocessgroup_headers", - vendor_available: true, - recovery_available: true, - host_supported: true, - export_include_dirs: ["include"], - target: { - linux_bionic: { - enabled: true, - }, - windows: { - enabled: true, - }, - }, -} - cc_library { - srcs: [ - "processgroup.cpp", - "sched_policy.cpp", - ], + srcs: ["processgroup.cpp"], name: "libprocessgroup", host_supported: true, recovery_available: true, - vendor_available: true, - vndk: { - enabled: true, - support_system_process: true, - }, - shared_libs: [ - "libbase", - "liblog", - ], - // for cutils/android_filesystem_config.h - header_libs: [ - "libcutils_headers", - "libprocessgroup_headers", - ], + shared_libs: ["libbase"], export_include_dirs: ["include"], - export_header_lib_headers: [ - "libprocessgroup_headers", - ], cflags: [ "-Wall", "-Werror", diff --git a/libprocessgroup/include/processgroup/sched_policy.h b/libprocessgroup/include/processgroup/sched_policy.h deleted file mode 100644 index 79a32fdeb..000000000 --- a/libprocessgroup/include/processgroup/sched_policy.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include <stdbool.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Check if Linux kernel enables CPUSETS feature. - * - * Return value: 1 if Linux kernel CONFIG_CPUSETS=y; 0 otherwise. - */ -extern bool cpusets_enabled(); - -/* - * Check if Linux kernel enables SCHEDTUNE feature (only available in Android - * common kernel or Linaro LSK, not in mainline Linux as of v4.9) - * - * Return value: 1 if Linux kernel CONFIG_CGROUP_SCHEDTUNE=y; 0 otherwise. - */ -extern bool schedboost_enabled(); - -/* Keep in sync with THREAD_GROUP_* in frameworks/base/core/java/android/os/Process.java */ -typedef enum { - SP_DEFAULT = -1, - SP_BACKGROUND = 0, - SP_FOREGROUND = 1, - SP_SYSTEM = 2, // can't be used with set_sched_policy() - SP_AUDIO_APP = 3, - SP_AUDIO_SYS = 4, - SP_TOP_APP = 5, - SP_RT_APP = 6, - SP_RESTRICTED = 7, - SP_CNT, - SP_MAX = SP_CNT - 1, - SP_SYSTEM_DEFAULT = SP_FOREGROUND, -} SchedPolicy; - -extern int set_cpuset_policy(int tid, SchedPolicy policy); - -/* Assign thread tid to the cgroup associated with the specified policy. - * If the thread is a thread group leader, that is it's gettid() == getpid(), - * then the other threads in the same thread group are _not_ affected. - * On platforms which support gettid(), zero tid means current thread. - * Return value: 0 for success, or -errno for error. - */ -extern int set_sched_policy(int tid, SchedPolicy policy); - -/* Return the policy associated with the cgroup of thread tid via policy pointer. - * On platforms which support gettid(), zero tid means current thread. - * Return value: 0 for success, or -1 for error and set errno. - */ -extern int get_sched_policy(int tid, SchedPolicy *policy); - -/* Return a displayable string corresponding to policy. - * Return value: non-NULL NUL-terminated name of unspecified length; - * the caller is responsible for displaying the useful part of the string. - */ -extern const char *get_sched_policy_name(SchedPolicy policy); - -#ifdef __cplusplus -} -#endif diff --git a/libprocessgroup/processgroup.cpp b/libprocessgroup/processgroup.cpp index 8d2ac3d57..9df8dd96f 100644 --- a/libprocessgroup/processgroup.cpp +++ b/libprocessgroup/processgroup.cpp @@ -42,7 +42,7 @@ #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> -#include <cutils/android_filesystem_config.h> +#include <private/android_filesystem_config.h> #include <processgroup/processgroup.h> diff --git a/libutils/Android.bp b/libutils/Android.bp index fb7ca3254..3e8417eb9 100644 --- a/libutils/Android.bp +++ b/libutils/Android.bp @@ -22,13 +22,11 @@ cc_library_headers { "liblog_headers", "libsystem_headers", "libcutils_headers", - "libprocessgroup_headers", ], export_header_lib_headers: [ "liblog_headers", "libsystem_headers", "libcutils_headers", - "libprocessgroup_headers", ], export_include_dirs: ["include"], @@ -84,7 +82,6 @@ cc_defaults { shared_libs: [ "libcutils", - "libprocessgroup", "libdl", "libvndksupport", ], diff --git a/libutils/Threads.cpp b/libutils/Threads.cpp index 31ca1383e..64bc4025d 100644 --- a/libutils/Threads.cpp +++ b/libutils/Threads.cpp @@ -36,7 +36,7 @@ #include <utils/Log.h> -#include <processgroup/sched_policy.h> +#include <cutils/sched_policy.h> #if defined(__ANDROID__) # define __android_unused diff --git a/lmkd/Android.bp b/lmkd/Android.bp index f9ed57cce..903d0e243 100644 --- a/lmkd/Android.bp +++ b/lmkd/Android.bp @@ -5,7 +5,6 @@ cc_binary { shared_libs: [ "libcutils", "liblog", - "libprocessgroup", ], static_libs: [ "libstatslogc", diff --git a/logcat/Android.bp b/logcat/Android.bp index 5030b1563..0543aba73 100644 --- a/logcat/Android.bp +++ b/logcat/Android.bp @@ -24,8 +24,8 @@ cc_defaults { ], shared_libs: [ "libbase", + "libcutils", "libpcrecpp", - "libprocessgroup", ], static_libs: ["liblog"], logtags: ["event.logtags"], diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp index 15e07feef..87bc6ae84 100644 --- a/logcat/logcat.cpp +++ b/logcat/logcat.cpp @@ -49,11 +49,11 @@ #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> +#include <cutils/sched_policy.h> #include <cutils/sockets.h> #include <log/event_tag_map.h> #include <log/logprint.h> #include <private/android_logger.h> -#include <processgroup/sched_policy.h> #include <system/thread_defs.h> #include <pcrecpp.h> diff --git a/logd/Android.bp b/logd/Android.bp index bdbdf12e4..3abfc2171 100644 --- a/logd/Android.bp +++ b/logd/Android.bp @@ -73,7 +73,6 @@ cc_binary { "libcutils", "libbase", "libpackagelistparser", - "libprocessgroup", "libcap", ], diff --git a/logd/main.cpp b/logd/main.cpp index fd3cdf877..8c38d9aa3 100644 --- a/logd/main.cpp +++ b/logd/main.cpp @@ -38,12 +38,12 @@ #include <android-base/macros.h> #include <cutils/android_get_control_file.h> #include <cutils/properties.h> +#include <cutils/sched_policy.h> #include <cutils/sockets.h> #include <log/event_tag_map.h> #include <packagelistparser/packagelistparser.h> #include <private/android_filesystem_config.h> #include <private/android_logger.h> -#include <processgroup/sched_policy.h> #include <utils/threads.h> #include "CommandListener.h" |