Commit graph

404 commits

Author SHA1 Message Date
Maciej Żenczykowski
503ac71b43 Merge "Revert "Set input thread priority to RT"" into main 2024-10-31 21:31:23 +00:00
Liana Kazanova
de6707df0c Revert "Set input thread priority to RT"
This reverts commit 930f77b02c.

Reason for revert: DroidMonitor: Potential culprit for http://b/376665573 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: I9b9914703946f1eb4e40e779aa9cb5154ea108d3
2024-10-31 18:43:18 +00:00
Treehugger Robot
ce6982c76b Merge "Set input thread priority to RT" into main 2024-10-31 00:17:00 +00:00
Siarhei Vishniakou
930f77b02c Set input thread priority to RT
To improve input latency, set the critical input threads to RT priority.
This will use RT priority on AOSP devices by default. OEMs can still
choose to customize what "input policy" means for their device, which
may not necessarily mean RT.

For example, on device with multiple small / big cores, input task
affinity could be changed to prioritize big cores + higher CPU frequency
/ voltage, but still keep the standard / default input thread priority.

With this patch, I'm finding that sometimes, one of the critical input
threads has priority 100 instead of the expected 98. Still looking into
that specific issue, but the issue is already present with the existing
"input policy" code.

Bug: 330719044
Flag: com.android.input.flags.enable_input_policy_profile
Test: took perfetto trace and checked the priority on InputDispatcher
and InputReader threads.

Change-Id: I75b6a726f0d066f16bdec26f6cf90721479d17ff
2024-10-30 00:09:32 +00:00
T.J. Mercier
96fc434b6c libprocessgroup: Remove ifdefery around SetTimerSlackAction::ExecuteForTask
This appears to have been due to the use of prctl, which apparently
caused issues for mac builds. Now that use of prctl has been removed, it
doesn't look like we need this anymore.

Fixes: 075008174 ("libprocessgroup: Remove prctl interface for setting timer slack")
Test: m
Bug: 372498744
Change-Id: I8a43951f30d7dd838591a8ba225d712742d7cd4a
2024-10-26 00:34:51 +00:00
T.J. Mercier
9611c18aa2 Don't use android::base::StartsWith / EndsWith
These libbase functions now directly pass through to the standard
library. [1] Use the standard library directly, and eliminate this
dependency on libbase.

[1] https://r.android.com/c/platform/system/libbase/+/3315082

Change-Id: I83d79ffa2658f30ae09a7f27cedf14e62b5df41d
2024-10-25 17:20:01 +00:00
T.J. Mercier
490b505a3f Merge changes from topic "reapply_no_cgroup.rc" into main
* changes:
  Reapply "libprocessgroup: Combine all 3 ActivateControllers imple..."
  Reapply "libprocessgroup: Remove ACgroupController_getMaxActivati..."
  Reapply "libprocessgroup: Remove dependency on libcgrouprc"
  Reapply "libprocessgroup: Remove cgroup.rc file"
2024-10-22 15:07:17 +00:00
Yihan Dong
f255ce1786 Merge "Add proposed trendy teams for VTS modules" into main 2024-10-22 00:09:17 +00:00
T.J. Mercier
cbe09a8058 Remove carlosgalo from libprocessgroup OWNERS
Change-Id: I37cac7694491a7efe16e835776dcd8be7335eabe
2024-10-21 17:10:34 +00:00
Treehugger Robot
2307e47ed0 Merge "libprocessgroup: Remove SetClamps action" into main 2024-10-15 22:56:36 +00:00
T.J. Mercier
3984611601 libprocessgroup: Add SetSchedulerPolicy Action
Add a new profile action that allows users to set a scheduler policy and
priority for a thread when a profile with the action is applied. This
can be used with the POSIX policies specified in the sched_setscheduler
man page. A priority value is required for real-time policies. A nice
value may optionally be provided for normal policies.

If a normal policy is used and a nice value is provided, it will be
applied with setpriority() after the scheduler policy is applied. The
range of nice values that can be used in the task profiles JSON in this
case is [-20, 19].

If a real-time policy is used, the range of priorities that can be used
in the task profiles JSON is [1, 99] which will be mapped onto
[sched_get_priority_min(), sched_get_priority_max()] at runtime for the
the provided policy.

Here are some examples:

Use lowest-priority with FIFO policy:
"Actions": [
  {
    "Name": "SetSchedulerPolicy",
    "Params":
    {
      "Policy": "SCHED_FIFO",
      "Priority": 1
    }
  }
]

Use highest-priority (lowest nice) with standard NORMAL scheduler:
"Actions": [
  {
    "Name": "SetSchedulerPolicy",
    "Params":
    {
      "Policy": "SCHED_OTHER",
      "Nice": -20
    }
  }
]

Bug: 368072932
BYPASS_INCLUSIVE_LANGUAGE_REASON=false positive
Change-Id: I502ceb3913016e9f4e6b6322cc0eee905c9a5c9a
2024-10-14 21:00:11 +00:00
Yihan Dong
900ef7bf3a Add proposed trendy teams for VTS modules
Change-Id: I4f62c5105f51b37fe61efe3ea61a88036cfb4b96
Test: build locally
Bug: 368362374
2024-10-12 08:53:10 +00:00
T.J. Mercier
2a030efe67 libprocessgroup: Remove SetClamps action
The SetClamps profile action has always been a no-op. Remove the class
and parsing code for this action.

Bug: 372915523
Change-Id: Ic6e685aa992b83464dfb5e6446b622a57ed61db5
2024-10-11 17:08:40 +00:00
T.J. Mercier
3e4b58e9d4 libprocessgroup: Remove unused prctl include
Fixes: 075008174 ("libprocessgroup: Remove prctl interface for setting timer slack")
Test: m
Bug: 372498744
Change-Id: Icb65d631cdc52b5f5434b33a593adf706314f66e
2024-10-10 16:25:46 +00:00
Treehugger Robot
3aff5e6b0a Merge "libprocessgroup: Use pid_t for ProfileAction::ExecuteForTask" into main 2024-10-10 00:13:25 +00:00
T.J. Mercier
b53eb9dbc6 libprocessgroup: Use pid_t for ProfileAction::ExecuteForTask
This was missed in commit 1c007996b ("libprocessgroup: Use pid_t
consistently for TIDs").

Change-Id: Idefc9e7c2161ab3163bd1a0cb68b899e10e9c8ed
2024-10-09 22:47:40 +00:00
T.J. Mercier
0750081742 libprocessgroup: Remove prctl interface for setting timer slack
Support for the procfs timerslack interface has existed since linux 4.6.
All currently supported Android kernels are newer than 4.6, so remove
the userspace support for the prctl interface leaving just the use of
/proc/<tid>/timerslack_ns.

Bug: 372498744
Change-Id: Ib34cc6fbb4bab328cde51d60ac4e3b26a0d72851
2024-10-09 18:43:56 +00:00
T.J. Mercier
787ddbc8a5 Reapply "libprocessgroup: Combine all 3 ActivateControllers imple..."
This reverts commit 0fa49253a4.

Change-Id: I83121ff295caaabc0a2fd8a606ee2d52dacb0174
2024-10-08 23:42:55 +00:00
T.J. Mercier
47580ff76d Reapply "libprocessgroup: Remove ACgroupController_getMaxActivati..."
This reverts commit aeca8793f5.

Change-Id: I06e7e651f0cabfd43b50a278baf36f31f6061a8f
2024-10-08 23:42:54 +00:00
T.J. Mercier
c76b6ada23 Reapply "libprocessgroup: Remove dependency on libcgrouprc"
This reverts commit 691ad736bb.

Change-Id: I6615792c24b5c3151ba789248cfbdfefaf57a1e4
2024-10-08 23:42:52 +00:00
T.J. Mercier
a09ee8ece6 Reapply "libprocessgroup: Remove cgroup.rc file"
This reverts commit 972a2d30f8.

Change-Id: Icdf2824675e515ea3656b1c58ac55160ecc337df
2024-10-08 23:42:49 +00:00
Priyanka Advani (xWF)
972a2d30f8 Revert "libprocessgroup: Remove cgroup.rc file"
Revert submission 3212512

Reason for revert: Droidmonitor created revert due to b/372273614. Will be verifying through ABTD before submission.

Reverted changes: /q/submissionid:3212512

Change-Id: I37568516e973cb940f1229d52f94b8dc801da2ab
2024-10-08 18:54:37 +00:00
Priyanka Advani (xWF)
691ad736bb Revert "libprocessgroup: Remove dependency on libcgrouprc"
Revert submission 3212512

Reason for revert: Droidmonitor created revert due to b/372273614. Will be verifying through ABTD before submission.

Reverted changes: /q/submissionid:3212512

Change-Id: I15c7763467cd9f65d4b389b2d4ccaff92012f21f
2024-10-08 18:54:37 +00:00
Priyanka Advani (xWF)
aeca8793f5 Revert "libprocessgroup: Remove ACgroupController_getMaxActivati..."
Revert submission 3212512

Reason for revert: Droidmonitor created revert due to b/372273614. Will be verifying through ABTD before submission.

Reverted changes: /q/submissionid:3212512

Change-Id: I0964d1300791334cdc9e98220324d934f7ba113e
2024-10-08 18:54:37 +00:00
Priyanka Advani (xWF)
0fa49253a4 Revert "libprocessgroup: Combine all 3 ActivateControllers imple..."
Revert submission 3212512

Reason for revert: Droidmonitor created revert due to b/372273614. Will be verifying through ABTD before submission.

Reverted changes: /q/submissionid:3212512

Change-Id: I3dadc0b7bccfe28bb067a93df2acf2c3ea0f9920
2024-10-08 18:54:40 +00:00
T.J. Mercier
5161033f66 libprocessgroup: Combine all 3 ActivateControllers implementations into one
Remove this code duplication and use just one interface.

Bug: 349105928
Change-Id: Id8c7186d9665e9087a654f5781b7593b06349160
2024-10-03 17:01:34 +00:00
T.J. Mercier
c31c5a75c8 libprocessgroup: Remove ACgroupController_getMaxActivationDepth
This was targeted for API 36 which doesn't exist yet, so this was never
released. Now that libprocessgroup does not use the libcgrouprc
interfaces, this can be removed.

Bug: 349105928
Bug: 359609093
Change-Id: I2ea466c9e8bc54bf9178fa74b45e88f26d3e4c69
2024-10-03 17:01:34 +00:00
T.J. Mercier
9d84103bdd libprocessgroup: Remove dependency on libcgrouprc
Read cgroup descriptors ourselves instead of going through the LLNDK
interface which performs the same thing.

Bug: 349105928
Change-Id: I94625ffd0d884d619eb3449e63a305ad5e1d77e3
2024-10-03 17:01:34 +00:00
T.J. Mercier
ae4ce8ccc5 libprocessgroup: Remove cgroup.rc file
The cgroup.rc file was introduced in 192aee782 ("libprocessgroup: Add
support for task profiles") back with the initial support for task
profiles. It was intended to optimize performance associated with cgroup
operations. However over time, supporting this file led to making
libprocessgroup code more complicated (such as the cgrouprc LLNDK
interface), and the file ended up getting mmaped into nearly every
process on Android even though only a handful of them actually use it.
Replacing this file with reading and parsing of cgroup information on
demand allows us to simplify and shrink libprocessgroup, and eliminates
thousands of unused mappings without negatively affecting boot time or
other performance metrics.

Bug: 349105928
Test: Verified with memcg v2 and MaxActivationDepth 1 on Cuttlefish, Raven, and Mokey
Change-Id: Ic3f01fdf7fda89a56ab80657e1cf4573156273e6
2024-10-03 17:01:34 +00:00
T.J. Mercier
981664df08 libprocessgroup: Remove schedtune support
Schedtune was an out of tree cgroup controller present in Android
kernels up to 4.19. It was replaced with uclamp and the cpu controller.
Now that 4.19 is EOL and unsupported, and schedtune is not present in
any supported Android kernels, remove the userspace support for
schedtune.

Bug: 362504801
Change-Id: If8baaf1a616984c5dbaac1bbd03e23ad001bc29c
2024-10-02 14:47:45 +00:00
Jerry Chang
2f84febec1 Merge "Add input event profile to mitigate input latency of input threads" into main 2024-09-18 10:36:32 +00:00
Jerry Chang
72b0186a38 Add input event profile to mitigate input latency of input threads
Bug: 347122505
Test: manual dump Perfetto

Change-Id: I224fa31a7358fcd32dfb1c3fa9dec35101e97163
2024-09-18 08:18:42 +00:00
Rick Yiu
a726c8c28c Add a new policy for for foreground of multi-window
Add SP_FOREGROUND_MW.

Bug: 200769420
Test: build pass
Change-Id: I203ebb2cbe0409b7bee8542ad276cd4e96c8eacb
2024-08-15 01:33:11 +00:00
Rick Yiu
673e6bb089 Create a new group for foreground of multi-window
In multi-window mode, currently the focused window will be top-app,
and others will be foreground. However, the cpu resource we assign to
typical foreground group may not meet the performance need of those
windows. Therefore, create a new group for them so that we could
distinguish their performance need.

Bug: 200769420
Test: group created
Change-Id: I84c61f9ed4d167e156dafb7a816b6482e80a8523
2024-08-15 01:29:48 +00:00
T.J. Mercier
ae0b290387 libprocessgroup: Convert libprocessgroup_util to static library
To avoid duplicate symbol linker error and prep for addition of json
descriptor reading and activation functions in upcoming changes.

Bug: 349105928
Test: m
Change-Id: I5cd663d6007ef330b872b8cf8ed046ee68b6d736
2024-08-12 21:15:09 +00:00
T.J. Mercier
7c94e5b25c libprocessgroup: Remove unused CgroupMap::SetupCgroups declaration
SetupCgroups was moved from CgroupMap in libprocessgroup to SetupCgroup
in libprocessgroup_setup, but the old declaration was not removed.

Fixes: 6f9ce2e548 ("libprocessgroup: Move CgroupSetupCgroups() to libprocessgroup_setup")
Test: m
Change-Id: I9f85000392b59a105bb202fae277a5582449822a
2024-08-09 18:35:29 +00:00
T.J. Mercier
9c53c803e1 libprocessgroup: Rename files a_cgroup_controller.cpp, a_cgroup_file.cpp
These are for ACgroupController and ACgroupFile, but share a filename
with libcgrouprc_format's CgroupController which can be confusing.

Bug: 349105928
Test: m
Change-Id: Idb270068169b71b0a33101407ddbb5a38cc8d469
2024-08-09 18:35:29 +00:00
T.J. Mercier
fcb8666eed libprocessgroup: Rename CgroupController -> CgroupControllerWrapper
So that the name is not overloaded with libcgrouprc_format's
CgroupController, which can be confusing.

Bug: 349105928
Test: m
Change-Id: I39df9814c500de68fd20139e661363ba51ea3543
2024-08-09 18:35:29 +00:00
Treehugger Robot
59a11e37aa Merge "Revert^2 "Move StagedRollbackTest from postsubmit to presubmit"" into main 2024-06-27 20:02:24 +00:00
T.J. Mercier
36e2a44710 Revert^2 "Move StagedRollbackTest from postsubmit to presubmit"
This reverts commit 104d3cc4b9.

Reason for revert: change from presubmit to presubmit-large
Bug: 349693967

Change-Id: I47ea41162aea0140bc460521d0638ce9ca8a96a3
2024-06-27 01:59:14 +00:00
T.J. Mercier
95a9a432be Merge "Revert "Move StagedRollbackTest from postsubmit to presubmit"" into main 2024-06-27 01:57:58 +00:00
Pechetty Sravani
104d3cc4b9 Revert "Move StagedRollbackTest from postsubmit to presubmit"
This reverts commit 0509c71cc4.

Reason for revert: Droidmonitor triggered revert due to Test breakage in b/349693967. Will be verifying through ABTD before submission.

Change-Id: I66a706b8b4f9bf802f7ea1a6b50bb4847b915c92
2024-06-27 01:49:59 +00:00
Treehugger Robot
40fd5beb0d Merge "Move StagedRollbackTest from postsubmit to presubmit" into main 2024-06-27 00:46:30 +00:00
T.J. Mercier
0509c71cc4 Move StagedRollbackTest from postsubmit to presubmit
Bug: 324596460
Change-Id: Iad7bfd7cb56f0c16366a9aa61b9466545ee4c661
2024-06-26 23:09:03 +00:00
T.J. Mercier
28b37f2704 libprocessgroup: Add MaxActivationDepth
Cgroup v2 controllers can be enabled in a subtree of the shared
hierarchy. That allows users to limit the number of cgroups with a
controller enabled to less than the total number of cgroups. [1]

There are costs for each cgroup. Kernel memory is used for each cgroup,
plus additional memory for each active controller in each cgroup. Some
kernel operations scale with the number of cgroups (with a given
controller enabled), so it can be desirable to minimize the number of
cgroups with that controller enabled.

This change allows each v2 controller configuration to specify a maximum
activation depth, past which the controller will not be activated deeper
in the Android cgroup v2 hierarchy. The hierarchy root is defined as
depth 0. MaxActivationDepth is the field name for this purpose for
controllers in the Controllers array under Cgroups2 in cgroups.json.

Here are two examples:

"MaxActivationDepth": 1
This will activate the controller in every per-application cgroup, but
not in the per-process cgroups below.

/sys/fs/cgroup                depth=0  active=true  (controller listed in cgroup.subtree_control)
/sys/fs/cgroup/uid_0          depth=1  active=true  (controller NOT listed in cgroup.subtree_control)
/sys/fs/cgroup/uid_0/pid_100  depth=2  active=false (controller NOT listed in cgroup.subtree_control)

This can also be used with
PRODUCT_CGROUP_V2_SYS_APP_ISOLATION_ENABLED := true.

"MaxActivationDepth": 1
This will activate the controller only at the app / system level, but
not in per-application cgroups below. This results in a total of only
3 cgroups with the controller enabled (root, apps, system).

/sys/fs/cgroup                         depth=0  active=true  (controller listed in cgroup.subtree_control)
/sys/fs/cgroup/apps                    depth=1  active=true  (controller NOT listed in cgroup.subtree_control)
/sys/fs/cgroup/apps/uid_10000          depth=2  active=false (controller NOT listed in cgroup.subtree_control)
/sys/fs/cgroup/apps/uid_10000/pid_100  depth=3  active=false (controller NOT listed in cgroup.subtree_control)

[1] https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#enabling-and-disabling

Bug: 346584259
Test: Cuttlefish with memcg v2
Change-Id: I62109ea935261c51fc30b2054c4d28d0360f7985
2024-06-18 15:50:21 +00:00
T.J. Mercier
54bfde03e1 libprocessgroup: Remove unused includes; add missing ones
No functional changes.

Bug: 346584259
Test: m
Change-Id: I68fa51f86b6baaa34fb2cdfdc16a4d1ff61e1e5f
2024-06-11 18:24:34 +00:00
T.J. Mercier
10826481ba libprocessgroup: Don't delegate to default constructor
Manually calling a defaulted default constructor from a another
constructor is superfluous, and can increase code size if the default
constructor is not otherwise used. There's nothing to delegate, so
remove the call.

Bug: 346584259
Test: m
Change-Id: Ia16aa041fdee7434587cf90645d7f95cba4e0d10
2024-06-11 18:24:23 +00:00
T.J. Mercier
df67107ac4 libprocessgroup: Use default member initializers
... instead of direct initialization in the default constructor
implementation. This allows us to just explicitly default the
constructor and provide no implementation.

Initialize class variables in the header and remove no-op constructor
to simplify code.

Bug: 346584259
Test: m
Change-Id: Iba57f5cfbf8e4d5d18ce178d39f8bcd2d76c8aaa
2024-06-11 18:23:58 +00:00
Kiyoung Kim
110308e5ab Merge "Remove VNDK definition(s)" into main 2024-05-23 00:38:19 +00:00
Treehugger Robot
b45c8ad05b Merge changes Ie74b9c27,If2224475 into main
* changes:
  libprocessgroup: Check validity of uid and pid arguments for createProcessGroup
  Revert "libprocessgroup: Check validity of uid and pid arguments"
2024-04-18 19:09:18 +00:00