public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* cpuset attach_task to touch per-cpu kernel threads?
@ 2007-06-21  1:49 Srivatsa Vaddagiri
  2007-06-21  2:35 ` Paul Jackson
  2007-06-21 12:16 ` Ingo Molnar
  0 siblings, 2 replies; 8+ messages in thread
From: Srivatsa Vaddagiri @ 2007-06-21  1:49 UTC (permalink / raw)
  To: pj; +Cc: clameter, Ingo Molnar, linux-kernel, Dinakar Guniguntala, akpm

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-06-22 17:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-21  1:49 cpuset attach_task to touch per-cpu kernel threads? Srivatsa Vaddagiri
2007-06-21  2:35 ` Paul Jackson
2007-06-21 12:16 ` Ingo Molnar
2007-06-21 17:07   ` Paul Jackson
2007-06-21 17:32     ` Srivatsa Vaddagiri
2007-06-21 17:51       ` Paul Jackson
2007-06-22 17:16         ` Srivatsa Vaddagiri
2007-06-22 17:41           ` Paul Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox