From: Robert Love
Date: Tue Mar 08 2005 - 18:59:18 EST
On Tue, 2005-03-08 at 23:36 +0000, J.A. Magallon wrote:
> Can cpu affinity really be changed for a running process ?
> Does it need something like io or yielding to take effect ?
> I am playin with Robert Love's taskset (symlinked to runon, it is easier
> to type and I'm more used to it), because I want to play with hyperthreading
> and wanted a method to force two threads on the same physical package.
> It works fine to bound a new process to a cpu set, but I does not change
> anything for a running process.
> I try runon -c -p 0 <pid> for my numbercruncher and it does nothing, top
> shows it is in the same cpus where it started:
> werewolf:~# runon -c -p 0 8277
> pid 8277's current affinity list: 0-3
> pid 8277's new affinity list: 0
> werewolf:~# runon -c -p 8277
> pid 8277's current affinity list: 0
This looks fine. As expected.
Although, you have the syntax wrong. It should be
taskset -c 0 -p 8277
taskset -p 8277
> The program uses posix threads, 2 in this case. The two threads change from
> cpu sometimes (not too often), but do not go into the same processor
> immediately as when I start the program directly with runon/taskset.
You have to bind all of the threads individually.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/