From: Andrea Arcangeli <andrea@suse.de>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Andrew Morton <andrewm@uow.edu.au>,
Klaus Dittrich <kladit@t-online.de>,
Linus Torvalds <torvalds@transmeta.com>,
linux-kernel@vger.kernel.org
Subject: Re: 2.4.7p6 hang
Date: Wed, 11 Jul 2001 18:53:08 +0200 [thread overview]
Message-ID: <20010711185308.J3496@athlon.random> (raw)
In-Reply-To: <200107110849.f6B8nlm00414@df1tlpc.local.here> <shslmlv62us.fsf@charged.uio.no> <3B4C56F1.3085D698@uow.edu.au> <15180.24844.687421.239488@charged.uio.no> <20010711175809.F3496@athlon.random> <15180.32563.739560.194630@charged.uio.no>
In-Reply-To: <15180.32563.739560.194630@charged.uio.no>; from trond.myklebust@fys.uio.no on Wed, Jul 11, 2001 at 06:30:43PM +0200
On Wed, Jul 11, 2001 at 06:30:43PM +0200, Trond Myklebust wrote:
> >>>>> " " == Andrea Arcangeli <andrea@suse.de> writes:
>
> > ksoftirqd is quite scheduler intensive, and while its startup
> > is correct (no need of any change there), it tends to trigger
> > scheduler bugs (one of those bugs was just fixed in pre5). The
> > reason I never seen the deadlock I also fixed this other
> > scheduler bug in my tree:
>
> > --- 2.4.4aa3/kernel/sched.c.~1~ Sun Apr 29 17:37:05 2001
> > +++ 2.4.4aa3/kernel/sched.c Tue May 1 16:39:42 2001
> > @@ -674,8 +674,10 @@
> > #endif
> > spin_unlock_irq(&runqueue_lock);
>
> > - if (prev == next)
> > + if (prev == next) {
> > + current->policy &= ~SCHED_YIELD;
> > goto same_process;
> > + }
>
> > #ifdef CONFIG_SMP
> > /*
>
> I no longer see the hang with this patch, but I'm not sure I
> understand why it works.
I do. It's very subtle and it goes down to the fork and scheduler
details.
> Does the above mean that the hang is occuring because spawn_ksoftirqd
> is yielding back to itself? If so, the semaphore trick seems more
No, that's a generic bug.
> robust, as it causes a proper sleep until it's safe to wake up.
rwsem is definitenly not more robust than the current code, if something
it hides if sched_yield is broken in the scheduler. no need to change
it wasting some static ram for a rwsem for no good reason.
The bug is that sched_yield must always be cleared at the time of a
fork() or the child may never get schedule. Only tasks running in-cpu are
allowed to have SCHED_YIELD set.
Another way to cure the deadlock could be to clear SCHED_YIELD in the child so
then you could even do something as silly as:
current->policy |= SCHED_YIELD;
fork()
schedule()
but the above doesn't make sense so we can optimize away the clear of
SCHED_YIELD of the child in fork. And even if you allow the above you
still need my attached fix for performance reason because if schedule()
returns that's all for the last sched_yield try, the next time we run
schedule without specifying sched_yield we don't want it to be threated
like a sched_yield again (that was the original reason of the patch
infact, I noticed now that the bug had very serious implication with
fork, such implication won't trigger only with ksoftirqd but also with
normal userspace forks, it's only that with ksoftirqd banging of the
scheduler it becomes reproducible).
Andrea
next prev parent reply other threads:[~2001-07-11 16:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-11 8:49 2.4.7p6 hang Klaus Dittrich
2001-07-11 12:56 ` Trond Myklebust
2001-07-11 13:38 ` Andrew Morton
2001-07-11 14:22 ` Trond Myklebust
2001-07-11 15:58 ` Andrea Arcangeli
2001-07-11 16:30 ` Trond Myklebust
2001-07-11 16:53 ` Andrea Arcangeli [this message]
2001-07-11 17:19 ` Mike Kravetz
2001-07-11 18:33 ` Josh Logan
2001-07-11 19:05 ` Andrea Arcangeli
2001-07-11 19:28 ` Josh Logan
2001-07-16 19:16 ` Josh Logan
2001-07-16 19:34 ` David Ford
2001-07-16 21:07 ` Josh Logan
2001-07-11 19:27 ` David Ford
2001-07-12 0:17 ` Johan Kullstam
2001-07-11 15:49 ` Andrea Arcangeli
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=20010711185308.J3496@athlon.random \
--to=andrea@suse.de \
--cc=andrewm@uow.edu.au \
--cc=kladit@t-online.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
--cc=trond.myklebust@fys.uio.no \
/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