From ed8b5853a6217f3691019831166b57f8e1a2ffa4 Mon Sep 17 00:00:00 2001 From: minaripenguin Date: Wed, 7 Feb 2024 17:56:11 +0800 Subject: [PATCH] init: Throttle background group utilization at 5% * taken from pixels Change-Id: Icfd60e716f189670dcf11aab434bbe043c94be0a Signed-off-by: minaripenguin --- rootdir/init.rc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rootdir/init.rc b/rootdir/init.rc index 544269007..277a785fe 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -250,6 +250,18 @@ on init write /dev/blkio/blkio.group_idle 0 write /dev/blkio/background/blkio.group_idle 0 + # Setup cpu.shares to throttle background groups (bg ~ 5% sysbg ~ 5% dex2oat ~2.5%) + write /dev/cpuctl/background/cpu.shares 1024 + write /dev/cpuctl/system-background/cpu.shares 1024 + write /dev/cpuctl/dex2oat/cpu.shares 512 + write /dev/cpuctl/system/cpu.shares 20480 + # We only have system and background groups holding tasks and the groups below are empty + write /dev/cpuctl/camera-daemon/cpu.shares 20480 + write /dev/cpuctl/foreground/cpu.shares 20480 + write /dev/cpuctl/nnapi-hal/cpu.shares 20480 + write /dev/cpuctl/rt/cpu.shares 20480 + write /dev/cpuctl/top-app/cpu.shares 20480 + restorecon_recursive /mnt mount configfs none /config nodev noexec nosuid