mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"Siddha, Suresh B" <suresh.b.siddha@intel.com>
Subject: Re: [patch 4/5] sched: RCU sched domains
Date: Wed, 6 Apr 2005 08:18:38 +0200	[thread overview]
Message-ID: <20050406061838.GB5973@elte.hu> (raw)
In-Reply-To: <425323A1.5030603@yahoo.com.au>


* Nick Piggin <nickpiggin@yahoo.com.au> wrote:

> 4/5

> 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>

i like it conceptually, so:

Acked-by: Ingo Molnar <mingo@elte.hu>

from now on, all domain-tree readonly uses have to be rcu_read_lock()-ed 
(or otherwise have to be in a non-preemptible section). But there's a 
bug in show_shedstats() which does a for_each_domain() from within a 
preemptible section. (It was a bug with the current hotplug logic too i 
think.)

At a minimum i think we need the fix+comment below.

	Ingo

Signed-off-by: Ingo Molnar <mingo@elte.hu>

--- linux/kernel/sched.c.orig
+++ linux/kernel/sched.c
@@ -260,6 +260,10 @@ struct runqueue {
 
 static DEFINE_PER_CPU(struct runqueue, runqueues);
 
+/*
+ * The domain tree (rq->sd) is RCU locked. I.e. it may only be accessed
+ * from within an rcu_read_lock() [or otherwise preempt-disabled] sections.
+ */
 #define for_each_domain(cpu, domain) \
 	for (domain = cpu_rq(cpu)->sd; domain; domain = domain->parent)
 
@@ -338,6 +342,7 @@ static int show_schedstat(struct seq_fil
 
 #ifdef CONFIG_SMP
 		/* domain-specific stats */
+		rcu_read_lock();
 		for_each_domain(cpu, sd) {
 			enum idle_type itype;
 			char mask_str[NR_CPUS];
@@ -361,6 +366,7 @@ static int show_schedstat(struct seq_fil
 			    sd->sbe_pushed, sd->sbe_attempts,
 			    sd->ttwu_wake_remote, sd->ttwu_move_affine, sd->ttwu_move_balance);
 		}
+		rcu_read_unlock();
 #endif
 	}
 	return 0;
 

  parent reply	other threads:[~2005-04-06  6:18 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     ` [patch 4/5] sched: RCU sched domains Nick Piggin
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       ` Ingo Molnar [this message]
2005-04-06  8:01         ` [patch 4/5] sched: RCU sched domains 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=20050406061838.GB5973@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®