RK3399 Android10 bind cpu with isolcpus

Per new request to bind cpus for some special processes, we need isolate some cpus of RK3399, which only used for thes special processes.

we can update dts file to set isolcpus arg in bootargs.

set isolcpus

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-android.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-android.dtsi
index 76753a9..a2a3206 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-android.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-android.dtsi
@@ -49,7 +49,7 @@
        compatible = "rockchip,android", "rockchip,rk3399";
 
        chosen: chosen {
-               bootargs = "earlycon=uart8250,mmio32,0xff1a0000 coherent_pool=1m";
+               bootargs = "earlycon=uart8250,mmio32,0xff1a0000 coherent_pool=1m isolcpus=4,5";
        };
 
        cpuinfo {

isolcpus=4,5 means isolate cpu4 and cpu5 which not used for common processes.

bind cpu

if we need set process to cpu4 or cpu5 which isolated, we can bind cpu with cmd taskset.

# bind cpu and start process, hex value 30 means 0b110000, means bind to cpu4 and cpu5.
taskset -p 30 <process-name>

# bind cpu with pid
taskset -p 30 <pid-of-process>

check cpu uses

with cmd mpstat, we can check current cpu uses for each cpu.

rk3399_keenon_tablet:/ # busybox mpstat -P ALL
Linux 4.19.193 (localhost)      12/06/23        _aarch64_       (6 CPU)

07:04:47     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
07:04:47     all   14.36    0.04   16.50    0.01    1.24    0.49    0.00    0.00   67.34
07:04:47       0   11.82    0.12   18.67    0.02    3.63    0.79    0.00    0.00   64.96
07:04:47       1   23.99    0.04   26.34    0.03    1.30    0.72    0.00    0.00   47.57
07:04:47       2   25.13    0.04   27.15    0.02    1.32    0.73    0.00    0.00   45.61
07:04:47       3   26.00    0.04   27.76    0.02    1.29    0.75    0.00    0.00   44.14
07:04:47       4    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
07:04:47       5    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00

references