[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070621014935.GF10980@linux.vnet.ibm.com>
Date: Thu, 21 Jun 2007 07:19:35 +0530
From: Srivatsa Vaddagiri <vatsa@...ux.vnet.ibm.com>
To: pj@....com
Cc: clameter@....com, Ingo Molnar <mingo@...e.hu>,
linux-kernel@...r.kernel.org,
Dinakar Guniguntala <dino@...ibm.com>,
akpm@...ux-foundation.org
Subject: cpuset attach_task to touch per-cpu kernel threads?
Paul,
You had once revealed a cute one-line command to move all tasks from
one cpuset to another [1], which was:
# move all tasks from top cpuset to 'foo' cpuset
sed -nu p < /dev/cpuset/tasks > /dev/cpuset/foo/tasks
I somewhat regret now having fallen for it and using it in my scripts.
To my agony, I found that it moves per-cpu kernel threads too, forcibly
breaking their affinity. In my case, rq->migration thread
(kernel/sched.c) was moved off cpu3 and started running on cpu2, which
caused nasty problems for me. I am sure this can lead to problems for
other per-cpu kernel threads, if their assumption of per-cpu'ness is
broken this way.
One could argue that 'root' user did this and nothing wrong in assuming
he knows what he is doing.
But I am wondering if attach_task() should leave kernel threads alone and
act only upon user-space threads. Or maybe allow movement if it doesn't
result in changing kernel-threads's cpu affinity.
Do you have anything to say regarding this?
Fyi, this was what I was doing (as root):
#!/bin/bash
mount -t container -o cpuset none /dev/cpuset
cd /dev/cpuset
mkdir sys # create a cpuset to move all tasks into
mkdir test # test cpuset in which my tests will run
# Assign cpus to both cpusets
cd sys; echo 0-2 > cpus; echo 0 > mems; echo 1 > cpu_exclusive; cd ..
cd test; echo 3 > cpus; echo 0 > mems; echo 1 > cpu_exclusive; cd ..
# Move all tasks to 'sys' cpuset so that cpu3 is dedicated to
# only my chosen tasks
sed -nu p < /dev/cpuset/tasks > /dev/cpuset/tasks
echo $$ > test/tasks
/path_to/test_prg
References:
1. http://marc.info/?l=linux-kernel&m=115627306628524
--
Regards,
vatsa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists