taskset命令用于设置进程(或 线程)的处理器亲和性(Processor Affinity),可以将进程(或 线程)绑定到特定的一个 或 多个CPU上去执行,而不允许将进程(或 线程)调度到其他的CPU上。
mtk平台
先获取surfaceflinger的pid信息
919 system -3 -8 11G 77M 46M S 15.0 0.9 6:21.48 surfaceflinger
一般surfaceflinger绑定在小核也就是0-3的小核,要绑定到大核就需要先解决限制的问题;
这里解决方法是把surfaceflinger echo到forground组,forground的cpus是0-7,涵盖所有核
echo 919 > /dev/cpuset/foreground/tasks
绑定到大核指令
taskset -p f0 919 // f0是掩码11110000,大核4-7都可以运行
查看进程的分组cpuset
cat /proc/919/cpuset
查看分组被限制在哪些cpu核上运行
cat /dev/cpuset/分组/cpus
分组情况:
k6789v1\_64:/dev/cpuset # ls
background cpus memory\_migrate notify\_on\_release tasks
camera-daemon effective\_cpus memory\_pressure release\_agent top-app
cgroup.clone\_children effective\_mems memory\_pressure\_enabled restricted
cgroup.procs foreground memory\_spread\_page sched\_load\_balance
cgroup.sane\_behavior mem\_exclusive memory\_spread\_slab sched\_relax\_domain\_level
cpu\_exclusive mem\_hardwall mems system-background