public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
To: pj@sgi.com
Cc: clameter@sgi.com, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Dinakar Guniguntala <dino@in.ibm.com>,
	akpm@linux-foundation.org
Subject: cpuset attach_task to touch per-cpu kernel threads?
Date: Thu, 21 Jun 2007 07:19:35 +0530	[thread overview]
Message-ID: <20070621014935.GF10980@linux.vnet.ibm.com> (raw)

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

             reply	other threads:[~2007-06-21  1:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-21  1:49 Srivatsa Vaddagiri [this message]
2007-06-21  2:35 ` cpuset attach_task to touch per-cpu kernel threads? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070621014935.GF10980@linux.vnet.ibm.com \
    --to=vatsa@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=dino@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=pj@sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox