Commit graph

323 commits

Author SHA1 Message Date
Kelvin Zhang
459edb0bd0 Make RemoveCgroup idempotent
When attempting to remove a cgroup, a ENOENT means this cgroup is
already removed. Treat such errno as success for idempotency.

Test: th
Bug: 308900853
Change-Id: I6ef3c25f03d185194205b3845784d284fdc4d444
2023-11-15 08:39:41 -08:00
T.J. Mercier
9431b63a7c libprocessgroup: Internal linkage for removeAllProcessGroupsInternal
This function is internal and shouldn't be visible externally.

Bug: 301871933
Change-Id: Ie8261795fa8b010c47da667f21e61949d7a9ae00
2023-11-07 13:52:36 +00:00
T.J. Mercier
4d0d285926 libprocessgroup: Convert incorrect PLOGs to LOGs
PLOG depends on errno being set to a useful value, otherwise it will
print a meaningless error string. A few PLOG call sites occur where
either errno is not set at all, or it is set only some of the time where
there are already PLOG calls closer to where the error occurs. Convert
these PLOG calls to LOG.

Bug: 301871933
Change-Id: Ifa6bd2401f9dd9b84b2506e886336e89bac81bb1
2023-11-03 18:34:56 +00:00
T.J. Mercier
a99e7d84cb libprocessgroup: Use correct language for cgroups
Refer to cgroups and the cgroup hierarchy by their correct names.

Bug: 301871933
Change-Id: Iebb3eac9363018e923773292786d01977c8763ae
2023-11-03 18:34:46 +00:00
T.J. Mercier
599d979126 libprocessgroup: Remove max_processes from KillProcessGroup API
The max_processes calculation is incorrect for KillProcessGroup because
the set of processes in cgroup.procs can differ between the multiple
reads in the implementation. Luckily the exact value isn't very
important because it's just logged. Remove max_processes from the API
and remove the warning about the new behavior in Android 11.

Note that we still always LOG(INFO) that any cgroup is being killed.

Bug: 301871933
Change-Id: I8e449f5089d4a48dbc1797b6d979539e87026f43
2023-10-31 16:31:44 +00:00
T.J. Mercier
af5de39039 Merge "libprocessgroup: Don't sleep after last cgroup removal attempt" into main 2023-10-07 00:34:39 +00:00
T.J. Mercier
b02f94490d libprocessgroup: Don't sleep after last cgroup removal attempt
Currently we sleep for 5ms before decrementing retries for the last
time. This is a waste of time, so bail out of the loop if the last
rmdir attempt fails.

Change-Id: Ia20840d27592b4eb3d9762647b19c111ff94209f
2023-10-06 23:11:09 +00:00
Xin Li
4484eb1bfd Merge Android U (ab/10368041)
Bug: 291102124
Merged-In: I849958d9e9de3be48e32f57acc7b3526e184482c
Change-Id: Ic765b54aa981b6370b5dff6b4cf046bbe9fbdbaf
2023-08-25 13:54:47 -07:00
Suren Baghdasaryan
3483798fd9 libprocessgroup: optimize SetAttributeAction::ExecuteForProcess performance
Current implementation of SetAttributeAction::ExecuteForProcess reuses
SetAttributeAction::ExecuteForTask while not utilizing available uid/pid
information. This results in a call to GetPathForTask() which is an
expensive function due to it reading and parsing /proc/$pid/cgroups.
This can be avoided if we utilize available uid/pid info and the fact
that cgroup v2 attributes share the cgroup v2 hierarchy as process
groups, which use a known path template.

Bug: 292636609
Change-Id: I02e3046bd85d0dfebc68ab444f1796bb54cc69c7
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-07-27 21:55:48 +00:00
Suren Baghdasaryan
3507846872 libprocessgroup: fix reset of file_v2_name
ProfileAttribute::Reset does not reset file_v2_name, fix that. Also
provide ProfileAttribute::file_name() to consolidate the code.

Bug: 292636609
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I5b33ca47b4fa5cabf582c8804bd13f72f6e58411
2023-07-27 21:55:40 +00:00
T.J. Mercier
aa6158b410 libprocessgroup: UIDs in linux are unsigned
We missed two incorrect specifiers in the previous commit with this same
title.

We use the %d format specificier for uid_t, which maps to
__kernel_uid32_t, which is unsigned. [1] This is undefined behavior
which can lead to paths with negative UIDs when erroneously large
values are passed for uid:

E libprocessgroup: No such cgroup attribute: /sys/fs/cgroup/uid_-89846/cgroup.freeze

Fix it with %u.

[1] https://cs.android.com/search?q=typedef.*__kernel_uid32_t&ss=android%2Fplatform%2Fsuperproject%2Fmain

Change-Id: Ica04b03526bd2e156f026a2797fe9912b259cd9f
2023-07-26 22:12:44 +00:00
T.J. Mercier
bf2bebd8e7 libprocessgroup: UIDs in linux are unsigned
We use the %d format specificier for uid_t, which maps to
__kernel_uid32_t, which is unsigned. [1] This is undefined behavior
which can lead to paths with negative UIDs when erroneously large
values are passed for uid:

E libprocessgroup: No such cgroup attribute: /sys/fs/cgroup/uid_-89846/cgroup.freeze

Fix it with %u.

[1] https://cs.android.com/search?q=typedef.*__kernel_uid32_t&ss=android%2Fplatform%2Fsuperproject%2Fmain

Change-Id: Ibb52ba2503e30e2f20770b7d23629167e38d076a
2023-07-21 00:39:57 +00:00
T.J. Mercier
9c8c748c11 libprocessgroup: Remove isolated UID cgroup directories
Global UID level cgroup removal was eliminated because of a race
between app launch and app killing using the same directory name. [1]

However isolated app UIDs are assigned sequentially, and are
basically never reused until we wrap around the large range of
isolated UIDs. This leaves thousands of isolated cgroup directories
unused, which consumes kernel memory and increases memory reclaim
overhead. Remove this subset of UID level cgroup directories when
killing process groups.

[1] d0464b0c01

Test: 50 cycle ACT leaves 1000 fewer empty isolated cgroups
Bug: 290953668
Change-Id: If7d2a7b8eec14561a72208049b74ff785ca961bd
2023-07-12 18:29:21 +00:00
Bart Van Assche
07f639d4d9 Revert "libprocessgroup: Add I/O scheduler attributes to task_profiles.json" am: 9fe0400080
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/23221374

Change-Id: I557ccd30751d0d6af0924c32259aa94354f3ef0e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-16 16:35:22 +00:00
Bart Van Assche
de4ac00254 Revert "Updating Attributes on task_profiles.json" am: f4a3d72ee8
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/23221373

Change-Id: I0af83a1250ee7f774c8f88958700b061da6bfdb3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-16 16:35:21 +00:00
Bart Van Assche
e8a7a44037 Revert "task_profiles.json: Convert tabs into spaces" am: 878406e7f1
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/23221372

Change-Id: I111a8d79047776938fec4cbafa545a711802c8d2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-16 16:35:19 +00:00
Bart Van Assche
9fe0400080 Revert "libprocessgroup: Add I/O scheduler attributes to task_profiles.json"
This reverts commit 9c0fcbb0f7.

Bug: 261857030
Ignore-AOSP-First: this change is for the U branch only.
Change-Id: Id4bd3494b33dd6bc0644406d599c9bfd597c7435
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-05-12 16:35:06 -07:00
Bart Van Assche
f4a3d72ee8 Revert "Updating Attributes on task_profiles.json"
This reverts commit 92153fb955.

Bug: 261857030
Ignore-AOSP-First: this change is for the U branch only.
Change-Id: I99417707f0d0b8c7dca3927b6ce9d52436621f4e
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-05-12 16:35:01 -07:00
Bart Van Assche
878406e7f1 Revert "task_profiles.json: Convert tabs into spaces"
This reverts commit 6ad747ac2d.

Bug: 261857030
Ignore-AOSP-First: this change is for the U branch only.
Change-Id: I93447b71146e6e9297ef49026d90dc4c35b91244
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-05-12 16:34:02 -07:00
Treehugger Robot
1a4d70e96b Merge "libprocessgroup: implement task profile validity checks" am: 3729536f8e am: 83a15feb1f am: ca3fde8141
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2534620

Change-Id: I88b7db54e830fd7dc41fef530aa73dbb4111cfb9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-01 21:14:13 +00:00
Suren Baghdasaryan
4a8c1461ff libprocessgroup: implement task profile validity checks
Provide profile validity check functions for cases when user wants to
check whether a profile can be successfully applied before actually
applying it. Add test cases to cover new APIs.

Also add a wrapper function for framework code to call it.

Bug: 277233783
Test: atest task_profiles_test
Test: manually verify freezer with outdated cgroup configuration
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Li Li <dualli@google.com>
Change-Id: Iefb321dead27adbe67721972f164efea213c06cb
Merged-In: Iefb321dead27adbe67721972f164efea213c06cb
2023-05-01 11:51:31 -07:00
Suren Baghdasaryan
8cacb6105c libprocessgroup: implement task profile validity checks
Provide profile validity check functions for cases when user wants to
check whether a profile can be successfully applied before actually
applying it. Add test cases to cover new APIs.

Also add a wrapper function for framework code to call it.

Bug: 277233783
Test: atest task_profiles_test
Test: manually verify freezer with outdated cgroup configuration
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Li Li <dualli@google.com>
Change-Id: Iefb321dead27adbe67721972f164efea213c06cb
2023-04-29 18:35:20 +00:00
Treehugger Robot
482053ee93 Merge "libprocessgroup: Remove unused uid_path from RemoveProcessGroup" am: 482feeecf7 am: 20aaa9ca86 am: 49a08b7209
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2563950

Change-Id: I9001df32b02a8db737b03db257ff2c0a9b51cdac
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-04-26 16:48:19 +00:00
T.J. Mercier
b83e6e4b32 libprocessgroup: Remove unused uid_path from RemoveProcessGroup
This variable is no longer used.

Fixes: d0464b0c01 ("libprocessgroup: Do not remove uid cgroups directory")
Change-Id: I2b606d953722cf38cc865d91ea00a3b08236675b
2023-04-25 23:37:16 +00:00
Treehugger Robot
2c15f8c06e Merge "task_profiles_test: Skip this test if cgroups is read-only" am: 229d3d27d8 am: b9fd48a4e6 am: 729f7b5b55
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2549390

Change-Id: I7e195fd81ec3130381269bdce93f925b0e7c966b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-04-20 01:59:38 +00:00
Bart Van Assche
8a20643f7f task_profiles_test: Skip this test if cgroups is read-only
GKE provides an unusual environment: the cgroupv2 filesystem is mounted
read-only. Skip the task_profiles_test on the host if the cgroup2
filesystem is mounted read-only to prevent that a test fails as
follows:

Failed to write '-1' to /sys/fs/cgroup/cgroup.procs: Read-only file system.

Bug: 278899193
Change-Id: I8c5a0c0848a47a395ae87f2fc31ba0ccda7d7f31
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-04-19 13:53:47 -07:00
Treehugger Robot
db83163b66 Merge "libprocessgroup: Add sendSignalToProcessGroup" into udc-dev 2023-04-13 23:25:15 +00:00
Treehugger Robot
04a44c1c5d Merge "libprocessgroup: Add sendSignalToProcessGroup" 2023-04-13 23:11:01 +00:00
T.J. Mercier
5ed5e1bb9f Revert "Revert "libprocessgroup: Add support for SetUserProfiles""
This reverts commit aee11b0a3d.

This change was originally reverted because its only user was reverted
under b/243096961 at ag/19679188. We bring it back now with a fixed user.

Bug: 236708592
Bug: 148425913
Ignore-AOSP-First: Topic with AMS changes which is developed on git_master

Change-Id: I2a8ae0d9faabe7950b758a09870d128889be4d0a
Merged-In: I2a8ae0d9faabe7950b758a09870d128889be4d0a
2023-04-13 22:05:31 +00:00
T.J. Mercier
22006bf004 libprocessgroup: Add sendSignalToProcessGroup
Add a function which sends signals to all members of a process group,
but does not wait for the processes to exit, or for the associated
cgroup to be removed.

Bug: 274646058
Ignore-AOSP-First: Dependency of ActivityManager change which developed on interal git_master
Test: Force-stop of chrome with 15 tabs completes ~500ms faster
Test: Full Play store update causes no ANR
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d87b6018d25cbbd33b345dc58c634718bf5d0def)
Merged-In: I37dbdecb3394101abbee8495e71f6912b3c031f5
Change-Id: I37dbdecb3394101abbee8495e71f6912b3c031f5

NOTE FOR REVIEWERS - original patch and result patch are not identical.
PLEASE REVIEW CAREFULLY.
Diffs between the patches:
37,6 +537,15 @@
     return KillProcessGroup(uid, initialPid, signal, 0 /*retries*/, max_processes);
 }
 
+int sendSignalToProcessGroup(uid_t uid, int initialPid, int signal) {
+    std::string hierarchy_root_path;
+    if (CgroupsAvailable()) {
+        CgroupGetControllerPath(CGROUPV2_CONTROLLER_NAME, &hierarchy_root_path);
+    }
+    const char* cgroup = hierarchy_root_path.c_str();
+    return DoKillProcessGroupOnce(cgroup, uid, initialPid, signal);
+}
+
 static int createProcessGroupInternal(uid_t uid, int initialPid, std::string cgroup,
                                       bool activate_controllers) {
     auto uid_path = ConvertUidToPath(cgroup.c_str(), uid);

Original patch:
From d87b6018d2 Mon Sep 17 00:00:00 2001
From: T.J. Mercier <tjmercier@google.com>
Date: Tue, 04 Apr 2023 18:41:13 +0000
Subject: [PATCH] libprocessgroup: Add sendSignalToProcessGroup

Add a function which sends signals to all members of a process group,
but does not wait for the processes to exit, or for the associated
cgroup to be removed.

Bug: 274646058
Ignore-AOSP-First: Dependency of ActivityManager change which developed on interal git_master
Test: Force-stop of chrome with 15 tabs completes ~500ms faster
Test: Full Play store update causes no ANR
Change-Id: I37dbdecb3394101abbee8495e71f6912b3c031f5
---

diff --git a/libprocessgroup/include/processgroup/processgroup.h b/libprocessgroup/include/processgroup/processgroup.h
index 8fa9fd5..48bc0b7 100644
--- a/libprocessgroup/include/processgroup/processgroup.h
+++ b/libprocessgroup/include/processgroup/processgroup.h
@@ -76,6 +76,11 @@
 // that it only returns 0 in the case that the cgroup exists and it contains no processes.
 int killProcessGroupOnce(uid_t uid, int initialPid, int signal, int* max_processes = nullptr);
 
+// Sends the provided signal to all members of a process group, but does not wait for processes to
+// exit, or for the cgroup to be removed. Callers should also ensure that killProcessGroup is called
+// later to ensure the cgroup is fully removed, otherwise system resources may leak.
+int sendSignalToProcessGroup(uid_t uid, int initialPid, int signal);
+
 int createProcessGroup(uid_t uid, int initialPid, bool memControl = false);
 
 // Set various properties of a process group. For these functions to work, the process group must

Change-Id: Ie479348dee8e8092b1959927a1143009632d3914
2023-04-13 21:48:55 +00:00
Treehugger Robot
aec29a4d97 Merge "libprocessgroup: fix task_profile_test to correctly detect cgroup v2" am: 253f33aac5 am: 32aaf75a1a am: 3395088268
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2534619

Change-Id: I1583db34987048d4d2680e50b738aee7d8c8cd8e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-04-12 23:19:02 +00:00
Suren Baghdasaryan
d09713fe40 libprocessgroup: fix task_profile_test to correctly detect cgroup v2
Use correct attribute of the mntent to check for cgroup v2 entry.

Bug: 277233783
Change-Id: Ie34b89b610117b8ce043f2f18947273d75618fef
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-04-12 21:07:50 +00:00
T.J. Mercier
d3dc653d22 libprocessgroup: Add sendSignalToProcessGroup
Add a function which sends signals to all members of a process group,
but does not wait for the processes to exit, or for the associated
cgroup to be removed.

Bug: 274646058
Ignore-AOSP-First: Dependency of ActivityManager change which developed on interal git_master
Test: Force-stop of chrome with 15 tabs completes ~500ms faster
Test: Full Play store update causes no ANR
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d87b6018d25cbbd33b345dc58c634718bf5d0def)
Merged-In: I37dbdecb3394101abbee8495e71f6912b3c031f5
Change-Id: I37dbdecb3394101abbee8495e71f6912b3c031f5
2023-04-12 16:18:36 +00:00
Treehugger Robot
9cff13459f Merge "libprocessgroup: Check validity of uid and pid arguments" am: c1798def91 am: f5d65bf11c am: 92824d9d04
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2475605

Change-Id: I245c9c521391386acee8c16dcb15d5cc08edb06e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-30 17:49:45 +00:00
Bart Van Assche
5a3c3f7ccf libprocessgroup: Check validity of uid and pid arguments
A user ID (uid) must be greater than or equal to zero to be valid. Only
strictly positive process IDs are valid. Add argument checks in
libprocessgroup of uid and pid arguments to make it easier to determine
the origin of invalid arguments.

Change-Id: I8a6d96ca4576bc9c329498c6a804dd05a02afca5
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-03-22 18:35:41 -07:00
Bart Van Assche
eef0f563fd [DO NOT MERGE] Migrate the blkio controller to the v2 cgroup hierarchy
There are multiple use cases in Android for which background writes need
to be controlled via the cgroup mechanism. The cgroup mechanism can only
control background writes if both the blkio and memcg controllers are
mounted in the v2 cgroup hierarchy. Hence this patch that migrates the
blkio controller from the v1 to the v2 cgroup hierarchy.

The blkio controller has been marked as optional since not all Android
kernels enable this controller (CONFIG_BLK_CGROUP).

This patch increases the TOTAL_BOOT_TIME for devices with a 4.19 kernel
(redfin) from 18.9 s to 20 s. This patch does not affect the boot time
for devices with a 5.10 or 5.15 kernel.

This patch increases the time spent in CgroupMap::ActivateControllers()
by 25 microseconds in Cuttlefish on an x86-64 CPU.
CgroupMap::ActivateControllers() is called by Service::Start().

Bug: 213617178
Test: Cuttlefish and various phones
Change-Id: I3c07c1be84c3feb277b7d7003652d5d3b57c6541
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-03-22 11:39:53 -07:00
Treehugger Robot
5746792152 Merge "libprocessgroup: Add argument checks in KillProcessGroup()" am: 1d25c20ada am: cca7467841 am: a1a60eed7b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2475609

Change-Id: Id336b422b81c4869413f7e82965689d604eeab2d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-15 23:14:37 +00:00
Bart Van Assche
51e58aced4 libprocessgroup: Add argument checks in KillProcessGroup()
Apparently there is Java code that calls KillProcessGroup() with an
invalid initialPid argument. Hence this CL that makes KillProcessGroup()
fail early if one of its arguments is invalid.

Change-Id: I42f98eed139d9d0950428d04180e4613ba74b4e6
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-03-15 09:35:06 -07:00
Inseob Kim
005596742b Merge "libprocessgroup: fix boot time performance regression" am: e89ee18b9b am: 12f447e607 am: ab4821d3f2
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2467504

Change-Id: Ic391acf818e48a074984186c208085b7426cb0a7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-03 19:39:18 +00:00
Suren Baghdasaryan
4f7cc8c345 libprocessgroup: fix boot time performance regression
The way processes are accounted in DoKillProcessGroupOnce has been
changed recently, which affects retries in KillProcessGroup. More specifically, initialPid was not counted before and would not
cause a retry with 5ms sleep.
Restore previous behavior to avoid boot time regressions.

Bug: 271198843
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ibc1bdd855898688a4a03806671e6ac31570aedf9
2023-03-03 00:11:13 +00:00
Krzysztof Kosiński
20d6ea1482 Merge "Fix invalid uses of PLOG." am: 0f90ba64bd am: 0cc793ef16 am: eea6ab5f87
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2462673

Change-Id: I959b195fd244d49fea64f1faf55714fa2bfef37e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-02 02:39:15 +00:00
Krzysztof Kosiński
0f90ba64bd Merge "Fix invalid uses of PLOG." 2023-03-02 00:52:20 +00:00
Krzysztof Kosiński
0310ec4b55 Fix invalid uses of PLOG.
PLOG reports the value of errno. These four PLOG statements are
after functions that are not syscalls, leading to confusing logs
such as "Failed to apply Foo task profile: Success".

Bug: 271196526
Test: N/A
Change-Id: Iede5274d1ceebabec8432527112291ba63dca090
2023-03-01 04:17:57 +00:00
Suren Baghdasaryan
fb598fd2c0 Merge "Kill its process group even if the given process is already dead" am: 763593e395 am: 2038ed868b am: f38b8818e9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2459289

Change-Id: I22ddd859726d5a33a2f4bbc8e7fd1f12ba7cc2db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-28 21:46:48 +00:00
Jing Ji
304c0f1c14 Kill its process group even if the given process is already dead
So the child processes in the process group won't be orphaned
when we decide to kill the process group of a given process but
find it's already dead.

Bug: 266633286
Test: atest MicrodroidDemoApp
Change-Id: Ib6f45b992566f0ab5cf152463c95294a306dd736
2023-02-27 22:01:34 -08:00
Bart Van Assche
7fabf57e12 Merge "libprocessgroup: Proceed if activation of an optional controller fails" am: 05c7e3c0c2 am: 850bac57b9 am: 7191e510d0
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2424613

Change-Id: I77c9be65b68b576129434a560c1a08eeac292f35
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-13 21:09:20 +00:00
Treehugger Robot
bbaebfc37c Merge "libprocessgroup: Rework SetupCgroup()" am: d35f56b199 am: 7e1218646c am: 5ff1e5353d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2424612

Change-Id: I268c38efe1bef2ffe00a2df5cfd59ec022e03e2a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-11 02:50:52 +00:00
Bart Van Assche
b0947e008a libprocessgroup: Proceed if activation of an optional controller fails
Not all Android kernels support all the cgroup controllers mentioned in
task_profiles.json and/or cgroups.json. Support such kernels by ignoring
certain cgroup activation failures.

Bug: 213617178
Change-Id: I90c0bd959f8a6484c4f2fbc895845e073527271e
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-02-10 15:02:44 -08:00
Bart Van Assche
1ec6ec4f57 libprocessgroup: Rework SetupCgroup()
Improve the readability of this function by splitting it.

This CL includes the following behavior changes:
- If changing the directory owner and/or mode fails for /sys/fs/cgroup,
  this is considered as a fatal error instead of something that should
  only fail if "Optional" has not been set.
- If mounting the v2 cgroup controller fails, this is considered as an
  error.
- Activating/mounting a cgroup controller only fails if the controller
  has not been marked as optional.

Bug: 213617178
Change-Id: If6908dfdbcb2e1c9637ab4ac8a7625f0a17dc9e0
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2023-02-10 14:18:38 -08:00
Bart Van Assche
ea625ac782 Merge "libprocessgroup: Introduce a local variable in CgroupMap::ActivateControllers()" am: d9098252c6 am: 79b8448729 am: f4c72869d9
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2424611

Change-Id: Ib54a66acb42d6ad60784acd16f9c1b93f6db42be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-09 23:12:18 +00:00