Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit d7088f8f authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Update uid process state synchronously

ActivityTaskManagerService has a mirror ActiveUids. Originally it
may be updated to an intermediate state (e.g. UidRecord.reset) and
the uid state can be accessed before the actual value is set. That
leads to unexpected behavior depends on timing.

Now the mirror ActiveUids will only be updated when the actual uid
state is decided during updating oom-adj. And by acquiring window
manager's lock when updating oom-adj, it also synchronizes other
states with activity task manager. Although an additional lock is
held, it is possible to have benefit that reduces the frequency
of lock and unlock.

Also optimize the usage of priority booster by having an alias lock
with different type declaration, then the overhead of unnecessary
nested boost injections can be eliminated.

Bug: 123502026
Test: atest ActivityManagerServiceTest
Test: Manual measure until the last boot complete receiver is done:
- Invocation of nested priority boost
  Reduce ~10000 times (50%, total 0.3s) boost invocation
- Invocation of updateOomAdjLocked
  ~170 times total reduces ~0.05s (only compare between with and
  without global lock)

Change-Id: I160f951e103835401ccaaf7c732ba407e011c39b
parent 195bafa1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment