我正在运行的命令是taskset -pc 0-1 1026.我也试过了0,1.输出是:
pid 1026's current affinity list: 0-3 pid 1026's new affinity list: 0-3
所以,它似乎并没有“坚持”.可以通过再次运行taskset来确认查找进程可用的cpu.这可能是我的虚拟化类型的问题吗?
我这样做是因为我时不时地需要MysqL运行得非常努力,超过2个小时超过2.0-4.0会让我重新启动我当前的提供商.
是否有明确原因导致无法正常工作,还是需要进行更多故障排除?
In RHEL5-based kernels we had the notion of virtual cpus: tasks were
scheduled on vcpus while the vcpus were somehow distributed among
physical cpus. The sched_setaffinity syscall could be used to bind
tasks to vcpus then.This concept was cumbersome and often sub-optimal so in RHEL6 we
decided to drop it: currently setting nr_cpus limit for a container
is actually equivalent to setting cpulimit. The decision is justified
by the fact that the latest Linux scheduler is smart enough to gather
actively interacting tasks together so that there is no need to limit
parallelism artificially.As a result,cpu affinity support was dropped. Tasks can still use the sched_setaffinity syscall,but it will be ignored.