linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erich Focht <efocht@ess.nec.de>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: O(1) J9 scheduler: set_cpus_allowed
Date: Fri, 1 Feb 2002 15:19:00 +0100 (MET)	[thread overview]
Message-ID: <Pine.LNX.4.21.0202011435500.6004-100000@sx6.ess.nec.de> (raw)

Hi Ingo,

the function set_cpus_allowed(task_t *p, unsigned long new_mask)
works "as is" only if called for the task p=current. The appended patch
corrects this and enables e.g. external load balancers to change the
cpus_allowed mask of an arbitrary process.

BTW: how about migrating the definition of the structures runqueue and
prio_array into include/linux/sched.h and exporting the symbol
runqueues? It would help with debugging, monitoring and other
developments.

Thanks,
Best regards,
Erich

--- 2.4.17-IA64-kdb-J9/kernel/sched.c	Thu Jan 31 18:39:37 2002
+++ 2.4.17-IA64-kdb-J9ia64/kernel/sched.c	Fri Feb  1 16:06:40 2002
@@ -859,16 +868,16 @@
 
 	p->cpus_allowed = new_mask;
 	/*
-	 * Can the task run on the current CPU? If not then
+	 * Can the task run on its current CPU? If not then
 	 * migrate the process off to a proper CPU.
 	 */
-	if (new_mask & (1UL << smp_processor_id()))
+	if (new_mask & (1UL << p->cpu))
 		return;
 #if CONFIG_SMP
-	current->state = TASK_UNINTERRUPTIBLE;
-	smp_migrate_task(__ffs(new_mask), current);
-
-	schedule();
+	p->state = TASK_UNINTERRUPTIBLE;
+	smp_migrate_task(__ffs(new_mask), p);
+	if (p == current)
+		schedule();
 #endif
 }
 


             reply	other threads:[~2002-02-01 14:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-01 14:19 Erich Focht [this message]
2002-02-01 17:08 ` O(1) J9 scheduler: set_cpus_allowed Ingo Molnar
2002-02-01 16:15   ` Erich Focht
2002-02-03 14:03     ` Ingo Molnar

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=Pine.LNX.4.21.0202011435500.6004-100000@sx6.ess.nec.de \
    --to=efocht@ess.nec.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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;
as well as URLs for NNTP newsgroup(s).