R-Car/Boards/Yocto-Gen3-CommonFAQ/Is it possible to use specific CPU core to run the specific application?

From eLinux.org
< R-Car‎ | Boards/Yocto-Gen3-CommonFAQ
Revision as of 18:03, 24 December 2020 by Y.H. (talk | contribs) (Created page with "== Is it possible to use specific CPU core to run the specific application? == There are several methods of realizing processor affiity under Linux.<br/> This FAQ descrives h...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Is it possible to use specific CPU core to run the specific application?

There are several methods of realizing processor affiity under Linux.
This FAQ descrives how to apply cgroup.

  1. Creating the big(CA57) and little(CA53) group
    root@m3ulcb:~# mkdir /sys/fs/cgroup/cpuset/big
    root@m3ulcb:~# mkdir /sys/fs/cgroup/cpuset/little
    
  2. Setting the memory node
    If you do not wish to specify the assignment of memory, set it to 0 as in our example.
    root@m3ulcb:~# echo 0 > /sys/fs/cgroup/cpuset/big/cpuset.mems
    root@m3ulcb:~# echo 0 > /sys/fs/cgroup/cpuset/little/cpuset.mems
    
  3. Assigning CPU resources to the groups
    Case of R-Car Starter Kit Pro(M3):
    root@m3ulcb:~# echo 0-1 > /sys/fs/cgroup/cpuset/big/cpuset.cpus
    root@m3ulcb:~# echo 2-5 > /sys/fs/cgroup/cpuset/little/cpuset.cpus
    
  4. Confirming the PIDs of applications
    root@m3ulcb:~# ps
    
  5. Assigning the applications
    root@m3ulcb:~# echo [PID] > /sys/fs/cgroup/cpuset/big/tasks
    root@m3ulcb:~# echo [PID] > /sys/fs/cgroup/cpuset/little/tasks
    
  6. Release from assignment to the big or little group
    root@m3ulcb:~# echo [PID] > /sys/fs/cgroup/cpuset/tasks