public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Ingo Molnar <mingo@elte.hu>
Cc: "David Lang" <david.lang@digitalinsight.com>,
	"Dieter Nützel" <Dieter.Nuetzel@hamburg.de>,
	"Linux Kernel List" <linux-kernel@vger.kernel.org>
Subject: Re: [announce] [patch] ultra-scalable O(1) SMP and UP scheduler
Date: Fri, 4 Jan 2002 14:36:59 +0100	[thread overview]
Message-ID: <20020104143659.I1561@athlon.random> (raw)
In-Reply-To: <Pine.LNX.4.40.0201040000070.18636-100000@dlang.diginsite.com> <Pine.LNX.4.33.0201041242500.2247-100000@localhost.localdomain>
In-Reply-To: <Pine.LNX.4.33.0201041242500.2247-100000@localhost.localdomain>; from mingo@elte.hu on Fri, Jan 04, 2002 at 12:44:57PM +0100

On Fri, Jan 04, 2002 at 12:44:57PM +0100, Ingo Molnar wrote:
> 
> On Fri, 4 Jan 2002, David Lang wrote:
> 
> > Ingo,
> > back in the 2.4.4-2.4.5 days when we experimented with the
> > child-runs-first scheduling patch we ran into quite a few programs that
> > died or locked up due to this. (I had a couple myself and heard of others)
> 
> hm, Andrea said that the only serious issue was in the sysvinit code,
> which should be fixed in any recent distro. Andrea?

correct. I run child-run-first always on all my boxes. And
those races could trigger also before, so it's better to make them more
easily reproducible anyways.

I always run with this patch applied:

diff -urN parent-timeslice/include/linux/sched.h child-first/include/linux/sched.h
--- parent-timeslice/include/linux/sched.h	Thu May  3 18:17:56 2001
+++ child-first/include/linux/sched.h	Thu May  3 18:19:44 2001
@@ -301,7 +301,7 @@
  * all fields in a single cacheline that are needed for
  * the goodness() loop in schedule().
  */
-	int counter;
+	volatile int counter;
 	int nice;
 	unsigned int policy;
 	struct mm_struct *mm;
diff -urN parent-timeslice/kernel/fork.c child-first/kernel/fork.c
--- parent-timeslice/kernel/fork.c	Thu May  3 18:18:31 2001
+++ child-first/kernel/fork.c	Thu May  3 18:20:40 2001
@@ -665,15 +665,18 @@
 	p->pdeath_signal = 0;
 
 	/*
-	 * "share" dynamic priority between parent and child, thus the
-	 * total amount of dynamic priorities in the system doesnt change,
-	 * more scheduling fairness. This is only important in the first
-	 * timeslice, on the long run the scheduling behaviour is unchanged.
+	 * Scheduling the child first is especially useful in avoiding a
+	 * lot of copy-on-write faults if the child for a fork() just wants
+	 * to do a few simple things and then exec().
 	 */
-	p->counter = (current->counter + 1) >> 1;
-	current->counter >>= 1;
-	if (!current->counter)
+	{
+		int counter = current->counter;
+		p->counter = (counter + 1) >> 1;
+		current->counter = counter >> 1;
+		p->policy &= ~SCHED_YIELD;
+		current->policy |= SCHED_YIELD;
 		current->need_resched = 1;
+	}
 
 	/* Tell the parent if it can get back its timeslice when child exits */
 	p->get_child_timeslice = 1;

> 
> > try switching this back to the current behaviour and see if the
> > lockups still happen.
> 
> there must be some other bug as well, the child-runs-first scheduling can
> cause lockups, but it shouldnt cause oopes.

definitely. My above implementation works fine.

Andrea

  parent reply	other threads:[~2002-01-04 13:37 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-04  7:42 [announce] [patch] ultra-scalable O(1) SMP and UP scheduler Dieter Nützel
2002-01-04  8:02 ` David Lang
2002-01-04 11:44   ` Ingo Molnar
2002-01-04 11:33     ` David Lang
2002-01-04 13:39       ` Andrea Arcangeli
2002-01-04 14:04       ` Ingo Molnar
2002-01-04 13:36     ` Andrea Arcangeli [this message]
2002-01-04 15:44       ` Ingo Molnar
2002-01-04 14:45         ` Andrea Arcangeli
     [not found] <20020107.191742.730580837.rene.rebe@gmx.net>
     [not found] ` <Pine.LNX.4.33.0201072124380.14212-100000@localhost.localdomain>
2002-01-07 19:53   ` Rene Rebe
  -- strict thread matches above, loose matches on Subject: below --
2002-01-07 17:34 Rene Rebe
     [not found] <20020104074239.94E016DAA6@mail.elte.hu>
2002-01-04 11:42 ` Ingo Molnar
2002-01-05  0:28   ` Roger Larsson
2002-01-05  7:53     ` george anzinger
2002-01-05 16:54       ` Robert Love
2002-01-05 12:42     ` Ingo Molnar
2002-01-04 11:16 rwhron
2002-01-04 13:20 ` Ingo Molnar
2002-01-04  3:56 Ed Tomlinson
2002-01-04  2:19 Ingo Molnar
2002-01-04  4:27 ` Oliver Xymoron
2002-01-04  5:34 ` Ian Morgan
2002-01-04 10:30 ` Anton Blanchard
2002-01-04 12:53   ` Ingo Molnar
2002-01-04 14:18 ` Thomas Cataldo
2002-01-04 14:46 ` dan kelley
2002-01-04 17:07   ` Ingo Molnar
2002-01-04 15:22     ` Nikita Danilov
2002-01-05  4:33 ` Davide Libenzi
2002-01-05 20:24   ` Ingo Molnar
2002-01-05 19:49     ` Mika Liljeberg
2002-01-05 22:00       ` Ingo Molnar
2002-01-05 21:04         ` Mika Liljeberg
2002-01-05 23:04     ` Davide Libenzi
2002-01-05 23:41       ` Alan Cox
2002-01-05 23:46         ` Davide Libenzi
2002-01-06  0:47       ` Linus Torvalds
2002-01-06  2:57         ` Ingo Molnar
2002-01-06  1:27           ` Linus Torvalds
2002-01-06  1:45             ` Davide Libenzi
2002-01-06  3:55               ` Ingo Molnar
2002-01-06  2:16                 ` Davide Libenzi
2002-01-06  3:41             ` Ingo Molnar
2002-01-06  2:02               ` Davide Libenzi
2002-01-06  2:13                 ` Alan Cox
2002-01-06  2:12                   ` Davide Libenzi
2002-01-06  2:20                     ` Alan Cox
2002-01-06  2:17                       ` Davide Libenzi
2002-01-06  4:07                   ` Ingo Molnar
2002-01-06  2:23                     ` Davide Libenzi
2002-01-06  2:30                     ` Alan Cox
2002-01-06  4:19                       ` Ingo Molnar
2002-01-07  3:08                   ` Richard Henderson
2002-01-07  3:16                     ` Linus Torvalds
2002-01-07  3:31                       ` Davide Libenzi
2002-01-07  3:34                         ` Linus Torvalds
2002-01-07  3:49                           ` Davide Libenzi
2002-01-06  4:01                 ` Ingo Molnar
2002-01-06  4:08               ` Ingo Molnar
2002-01-06  4:16                 ` Ingo Molnar
2002-01-06  3:55                   ` Luc Van Oostenryck
2002-01-07  8:00             ` Jens Axboe
2002-01-06  2:49       ` Ingo Molnar
2002-01-07  2:58 ` Rusty Russell

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=20020104143659.I1561@athlon.random \
    --to=andrea@suse.de \
    --cc=Dieter.Nuetzel@hamburg.de \
    --cc=david.lang@digitalinsight.com \
    --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