LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   migrate system process using cpuset failed (https://www.linuxquestions.org/questions/programming-9/migrate-system-process-using-cpuset-failed-928424/)

guanglei 02-09-2012 12:41 AM

migrate system process using cpuset failed
 
Hi,
some system processes are bound to a specific cpu, but when I want to migrate them to a sub cpuset, the echo will give an error of "write error: Invalid argument":

[root@pexserv02 tmp]# numactl --hardware
available: 2 nodes (0-1)
node 0 cpus: 0 1 2 3
node 0 size: 16373 MB
node 0 free: 14278 MB
node 1 cpus: 4 5 6 7
node 1 size: 16384 MB
node 1 free: 15231 MB
node distances:
node 0 1
0: 10 21
1: 21 10
[root@pexserv02 tmp]# taskset -c -p 31987
pid 31987's current affinity list: 1
[root@pexserv02 tmp]# pwd
/dev/cpuset/tmp
[root@pexserv02 tmp]# cat cpus
2-3
[root@pexserv02 tmp]# cat mems
0-1
[root@pexserv02 tmp]# echo 31987 > tasks
-bash: echo: write error: Invalid argument
[root@pexserv02 tmp]#

Does anyone know why the migration failed? Thanks

syg00 02-09-2012 12:56 AM

Pretty obvious I would have thought. The only CPU that the task has affinity to isn't in the subset.
Change its affinity mapping first.

guanglei 02-09-2012 01:47 AM

Quote:

Originally Posted by syg00 (Post 4597759)
Pretty obvious I would have thought. The only CPU that the task has affinity to isn't in the subset.
Change its affinity mapping first.

But when I tried to migrate a process to a cpuset which is the subset of its current cpu list, it still failed:

[root@pexserv02 tmp]# cat /dev/cpuset/cpus
0-7
[root@pexserv02 tmp]# grep "\<25\>" /dev/cpuset/tasks
25
[root@pexserv02 tmp]# taskset -pc 25
pid 25's current affinity list: 7
[root@pexserv02 tmp]# cat /dev/cpuset/tmp/cpus
1-2,5-7
[root@pexserv02 tmp]# echo 25 > /dev/cpuset/tmp/tasks
-bash: echo: write error: Invalid argument
[root@pexserv02 tmp]#

syg00 02-09-2012 03:26 AM

What system/kernel level are you using - and what cpusets doco ?.

cpusets is deprecated, and I haven't used it in years - cgroups is the current implementation (current cpusets gets mapped to cgroups). Maybe you're hitting a compatibility snag. I always follow the cgroups doco and mount at /sys.
However it is also true that I don't have (never had) access to NUMA equipment to test.

guanglei 02-09-2012 08:18 AM

Quote:

Originally Posted by syg00 (Post 4597857)
What system/kernel level are you using - and what cpusets doco ?.

cpusets is deprecated, and I haven't used it in years - cgroups is the current implementation (current cpusets gets mapped to cgroups). Maybe you're hitting a compatibility snag. I always follow the cgroups doco and mount at /sys.
However it is also true that I don't have (never had) access to NUMA equipment to test.

Thanks for your reply. I am using RHEL6, and kerenl version is 2.6.32-71.el6.x86_64.
I am not aware that cpuset is deprecated. I will try cgroups.


All times are GMT -5. The time now is 04:23 AM.