From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@elte.hu>,
"Siddha, Suresh B" <suresh.b.siddha@intel.com>
Subject: [patch 4/5] sched: RCU sched domains
Date: Wed, 06 Apr 2005 09:47:45 +1000 [thread overview]
Message-ID: <425323A1.5030603@yahoo.com.au> (raw)
In-Reply-To: <42532346.5050308@yahoo.com.au>
[-- Attachment #1: Type: text/plain, Size: 4 bytes --]
4/5
[-- Attachment #2: sched-rcu-domains.patch --]
[-- Type: text/plain, Size: 3445 bytes --]
One of the problems with the multilevel balance-on-fork/exec is that it
needs to jump through hoops to satisfy sched-domain's locking semantics
(that is, you may traverse your own domain when not preemptable, and
you may traverse others' domains when holding their runqueue lock).
balance-on-exec had to potentially migrate between more than one CPU before
finding a final CPU to migrate to, and balance-on-fork needed to potentially
take multiple runqueue locks.
So bite the bullet and make sched-domains go completely RCU. This actually
simplifies the code quite a bit.
Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au>
Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c 2005-04-05 16:39:14.000000000 +1000
+++ linux-2.6/kernel/sched.c 2005-04-05 18:39:05.000000000 +1000
@@ -825,22 +825,12 @@ inline int task_curr(const task_t *p)
}
#ifdef CONFIG_SMP
-enum request_type {
- REQ_MOVE_TASK,
- REQ_SET_DOMAIN,
-};
-
typedef struct {
struct list_head list;
- enum request_type type;
- /* For REQ_MOVE_TASK */
task_t *task;
int dest_cpu;
- /* For REQ_SET_DOMAIN */
- struct sched_domain *sd;
-
struct completion done;
} migration_req_t;
@@ -862,7 +852,6 @@ static int migrate_task(task_t *p, int d
}
init_completion(&req->done);
- req->type = REQ_MOVE_TASK;
req->task = p;
req->dest_cpu = dest_cpu;
list_add(&req->list, &rq->migration_queue);
@@ -4365,17 +4354,9 @@ static int migration_thread(void * data)
req = list_entry(head->next, migration_req_t, list);
list_del_init(head->next);
- if (req->type == REQ_MOVE_TASK) {
- spin_unlock(&rq->lock);
- __migrate_task(req->task, cpu, req->dest_cpu);
- local_irq_enable();
- } else if (req->type == REQ_SET_DOMAIN) {
- rq->sd = req->sd;
- spin_unlock_irq(&rq->lock);
- } else {
- spin_unlock_irq(&rq->lock);
- WARN_ON(1);
- }
+ spin_unlock(&rq->lock);
+ __migrate_task(req->task, cpu, req->dest_cpu);
+ local_irq_enable();
complete(&req->done);
}
@@ -4606,7 +4587,6 @@ static int migration_call(struct notifie
migration_req_t *req;
req = list_entry(rq->migration_queue.next,
migration_req_t, list);
- BUG_ON(req->type != REQ_MOVE_TASK);
list_del_init(&req->list);
complete(&req->done);
}
@@ -4903,10 +4883,7 @@ static int __devinit sd_parent_degenerat
*/
void __devinit cpu_attach_domain(struct sched_domain *sd, int cpu)
{
- migration_req_t req;
- unsigned long flags;
runqueue_t *rq = cpu_rq(cpu);
- int local = 1;
struct sched_domain *tmp;
/* Remove the sched domains which do not contribute to scheduling. */
@@ -4923,24 +4900,7 @@ void __devinit cpu_attach_domain(struct
sched_domain_debug(sd, cpu);
- spin_lock_irqsave(&rq->lock, flags);
-
- if (cpu == smp_processor_id() || !cpu_online(cpu)) {
- rq->sd = sd;
- } else {
- init_completion(&req.done);
- req.type = REQ_SET_DOMAIN;
- req.sd = sd;
- list_add(&req.list, &rq->migration_queue);
- local = 0;
- }
-
- spin_unlock_irqrestore(&rq->lock, flags);
-
- if (!local) {
- wake_up_process(rq->migration_thread);
- wait_for_completion(&req.done);
- }
+ rq->sd = sd;
}
/* cpus with isolated domains */
@@ -5215,6 +5175,7 @@ static int update_sched_domains(struct n
case CPU_DOWN_PREPARE:
for_each_online_cpu(i)
cpu_attach_domain(NULL, i);
+ synchronize_kernel();
arch_destroy_sched_domains();
return NOTIFY_OK;
next prev parent reply other threads:[~2005-04-05 23:49 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-05 23:44 [patch 1/5] sched: remove degenerate domains Nick Piggin
2005-04-05 23:45 ` [patch 2/5] sched: NULL domains Nick Piggin
2005-04-05 23:46 ` [patch 3/5] sched: multilevel sbe and sbf Nick Piggin
2005-04-05 23:47 ` Nick Piggin [this message]
2005-04-05 23:49 ` [patch 5/5] sched: consolidate sbe sbf Nick Piggin
2005-04-06 6:27 ` Ingo Molnar
2005-04-06 8:09 ` Nick Piggin
2005-04-06 8:16 ` Nick Piggin
2005-04-07 7:17 ` Ingo Molnar
2005-04-07 7:15 ` Ingo Molnar
2005-04-06 6:18 ` [patch 4/5] sched: RCU sched domains Ingo Molnar
2005-04-06 8:01 ` Nick Piggin
2005-04-07 7:11 ` Ingo Molnar
2005-04-07 7:58 ` Nick Piggin
2005-04-11 22:15 ` Paul E. McKenney
2005-04-12 0:03 ` Nick Piggin
2005-04-06 5:54 ` [patch 3/5] sched: multilevel sbe and sbf Ingo Molnar
2005-04-06 7:53 ` Nick Piggin
2005-04-06 5:45 ` [patch 2/5] sched: NULL domains Ingo Molnar
2005-04-06 5:48 ` Ingo Molnar
2005-04-06 7:51 ` Nick Piggin
2005-04-06 5:44 ` [patch 1/5] sched: remove degenerate domains Ingo Molnar
2005-04-06 7:10 ` Siddha, Suresh B
2005-04-06 7:13 ` Ingo Molnar
2005-04-06 8:12 ` Nick Piggin
2005-04-06 7:49 ` Nick Piggin
2005-04-07 7:00 ` 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=425323A1.5030603@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=suresh.b.siddha@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.