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

Commit e49c690e authored by Kshitij Gupta's avatar Kshitij Gupta
Browse files

SystemUI: Implement IntrinsicLockDispatcher for background tasks

- This commit refactors the background coroutine dispatcher in SystemUI
  to utilize a new, custom IntrinsicLockDispatcher.
- Previously, newFixedThreadPoolContext was used which internally uses
  ScheduledThreadPoolExecutor, that has been found to cause unintended
  waiting on the main thread, during background work and poor scheduling
  decisions. This was due to its reliance on a single internal
  ReentrantLock for all queue operations, leading to lock contention.
- This new dispatcher uses a ThreadPoolExecutor paired with a custom,
  ReentrantLock-free SynchronizedLinkedBlockingQueue. This queue uses
  intrinsic monitor locks (synchronized) to mitigate contention between
  worker threads and task-submitting threads.
- Improvements: A shell script was written to unlock, drag the shade,
  dismiss the shade and relock the device. During this, a perfetto trace
  was captured with the flag on and off, both across multiple
  iterations. The following improvements were seen in regards to stall
  durations (decrease is good):
  - Mean duration decreased by 5.97%
  - Peak duration decreased by 25.96%
  - Sum duration decreased by 24.77%
  - Trough duration slightly increased by 0.97%

Flag: com.android.systemui.sysui_intrinsic_lock_dispatcher
Test: Manual
Bug: 419472502
Change-Id: I0585c354311b1e7abec908de85265dd0a62e2764
parent a6f51b89
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