public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
To: Paul Jackson <pj@sgi.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	clameter@sgi.com, linux-kernel@vger.kernel.org, dino@in.ibm.com,
	akpm@linux-foundation.org
Subject: Re: cpuset attach_task to touch per-cpu kernel threads?
Date: Thu, 21 Jun 2007 23:02:32 +0530	[thread overview]
Message-ID: <20070621173232.GP10980@linux.vnet.ibm.com> (raw)
In-Reply-To: <20070621100712.52a4784a.pj@sgi.com>

On Thu, Jun 21, 2007 at 10:07:12AM -0700, Paul Jackson wrote:
> Ingo, responding to Srivatsa:
> > > Or maybe allow movement if it 
> > > doesn't result in changing kernel-threads's cpu affinity.
> > 
> > yeah, i'd agree ..
> 
> Good point.  I'd agree too.

Yeah .."allow movement if it doesn't result in changing kernel-threads's cpu 
affinity" sounds good, except it is hard to implement in cpuset's
context I think. For ex: we now have to take additional steps when
changing 'cpus_allowed' of a cpuset such that it doesn't violate any cpu
affinity of kernel threads bound to the cpuset. That itself makes the
implementation complex I think.

How about a simpler patch which bans movement of kernel threads from its
home cpuset (i.e top cpuset)?


Index: current/kernel/cpuset.c
===================================================================
--- current.orig/kernel/cpuset.c	2007-06-21 19:42:18.000000000 +0530
+++ current/kernel/cpuset.c	2007-06-21 22:24:38.000000000 +0530
@@ -881,6 +881,10 @@
 	if (cpus_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))
 		return -ENOSPC;
 
+	/* Don't allow kernel threads to be moved */
+	if (!tsk->mm)
+		return -EINVAL;
+
 	return security_task_setscheduler(tsk, 0, NULL);
 }
 

This probably catches exiting user-space tasks also (whose ->mm pointer is 
null).  Hmm ..there should be a better check for kernel threads.


-- 
Regards,
vatsa

  reply	other threads:[~2007-06-21 17:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=20070621173232.GP10980@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