public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	Steven Rostedt <rostedt@goodmis.org>,
	Christoph Lameter <clameter@sgi.com>
Subject: Re: [PATCH -rt 2/5] Thread Migration Preemption - v2
Date: Sat, 14 Jul 2007 21:07:31 +0200	[thread overview]
Message-ID: <1184440051.5284.72.camel@lappy> (raw)
In-Reply-To: <1184438694.5284.69.camel@lappy>

How about somethign like this?

---

Avoid busy looping on unmigratable tasks by pushing the migration requests
onto a delayed_migration_queue, which we try on each wakeup.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 kernel/sched.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c
+++ linux-2.6/kernel/sched.c
@@ -288,6 +288,7 @@ struct rq {
 
 	struct task_struct *migration_thread;
 	struct list_head migration_queue;
+	struct list_head delayed_migration_queue;
 #endif
 
 #ifdef CONFIG_SCHEDSTATS
@@ -5623,6 +5624,11 @@ static int migration_thread(void *data)
 		head = &rq->migration_queue;
 
 		if (list_empty(head)) {
+			/*
+			 * we got a wakeup, give the delayed list another shot.
+			 */
+			if (current->state != TASK_INTERRUPTIBLE)
+				list_splice(&rq->delayed_migration_queue, head);
 			spin_unlock_irq(&rq->lock);
 			schedule();
 			set_current_state(TASK_INTERRUPTIBLE);
@@ -5641,8 +5647,7 @@ static int migration_thread(void *data)
 			 * wake us up.
 			 */
 			spin_lock_irq(&rq->lock);
-			head = &rq->migration_queue;
-			list_add(&req->list, head);
+			list_add(&req->list, &rq->delayed_migration_queue);
 			set_tsk_thread_flag(req->task, TIF_NEED_MIGRATE);
 			spin_unlock_irq(&rq->lock);
 			wake_up_process(req->task);
@@ -7006,6 +7011,7 @@ void __init sched_init(void)
 		rq->cpu = i;
 		rq->migration_thread = NULL;
 		INIT_LIST_HEAD(&rq->migration_queue);
+		INIT_LIST_HEAD(&rq->delayed_migration_queue);
 #endif
 		atomic_set(&rq->nr_iowait, 0);
 



  reply	other threads:[~2007-07-14 19:08 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-14 17:57 [PATCH -rt 0/5] making SLUB -rt friendly Peter Zijlstra
2007-07-14 17:57 ` [PATCH -rt 1/5] workqueue: queue_work_cpu Peter Zijlstra
2007-07-14 17:14   ` Oleg Nesterov
2007-07-14 18:00     ` Peter Zijlstra
2007-07-14 17:57 ` [PATCH -rt 2/5] Thread Migration Preemption - v2 Peter Zijlstra
2007-07-14 16:49   ` Mathieu Desnoyers
2007-07-14 17:16   ` Oleg Nesterov
2007-07-14 17:34     ` Peter Zijlstra
2007-07-14 18:44     ` Peter Zijlstra
2007-07-14 19:07       ` Peter Zijlstra [this message]
2007-07-14 20:39         ` Mathieu Desnoyers
2007-07-14 20:48         ` Oleg Nesterov
2007-07-14 20:53           ` Peter Zijlstra
2007-07-14 17:57 ` [PATCH -rt 3/5] asm/local.h cmpxchg Peter Zijlstra
2007-07-14 16:52   ` Daniel Walker
2007-07-14 17:14   ` Mathieu Desnoyers
2007-07-14 17:31     ` Peter Zijlstra
2007-07-14 18:33       ` Mathieu Desnoyers
2007-07-14 17:57 ` [PATCH -rt 4/5] use migrate_disable for __local_begin Peter Zijlstra
2007-07-14 17:16   ` Mathieu Desnoyers
2007-07-14 17:32     ` Peter Zijlstra
2007-07-14 18:35       ` Mathieu Desnoyers
2007-07-14 18:41         ` Peter Zijlstra
2007-07-14 18:52           ` Mathieu Desnoyers
2007-07-14 17:57 ` [PATCH -rt 5/5] slub: -rt port Peter Zijlstra
2007-07-14 17:39   ` Oleg Nesterov
2007-07-14 17:50     ` Peter Zijlstra
2007-07-14 19:38       ` Oleg Nesterov
2007-07-14 19:49         ` Peter Zijlstra

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=1184440051.5284.72.camel@lappy \
    --to=a.p.zijlstra@chello.nl \
    --cc=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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