From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Linas Vepstas <linas@austin.ibm.com>,
Paul Mackerras <paulus@samba.org>,
Anton Blanchard <anton@samba.org>, Andrew Morton <akpm@osdl.org>,
linuxppc64-dev <linuxppc64-dev@ozlabs.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: PATCH [PPC64]: dead processes never reaped
Date: Tue, 19 Apr 2005 11:25:15 +1000 [thread overview]
Message-ID: <1113873915.5074.6.camel@npiggin-nld.site> (raw)
In-Reply-To: <1113872821.5516.330.camel@gaston>
On Tue, 2005-04-19 at 11:07 +1000, Benjamin Herrenschmidt wrote:
> On Mon, 2005-04-18 at 14:38 -0500, Linas Vepstas wrote:
> >
> > Hi,
> >
> > The patch below appears to fix a problem where a number of dead processes
> > linger on the system. On a highly loaded system, dozens of processes
> > were found stuck in do_exit(), calling thier very last schedule(), and
> > then being lost forever.
> >
> > Processes that are PF_DEAD are cleaned up *after* the context switch,
> > in a routine called finish_task_switch(task_t *prev). The "prev" gets
> > the value returned by _switch() in entry.S, but this value comes from
> >
> > __switch_to (struct task_struct *prev,
> > struct task_struct *new)
> > {
> > old_thread = ¤t->thread; ///XXX shouldn't this be prev, not current?
> > last = _switch(old_thread, new_thread);
> > return last;
> > }
> >
> > The way I see it, "prev" and "current" are almost always going to be
> > pointing at the same thing; however, if a "need resched" happens,
> > or there's a pre-emept or some-such, then prev and current won't be
> > the same; in which case, finish_task_switch() will end up cleaning
> > up the old current, instead of prev. This will result in dead processes
> > hanging around, which will never be scheduled again, and will never
> > get a chance to have put_task_struct() called on them.
>
> Ok, thinking moer about this ... that will need maybe some help from
> Ingo so I fully understand where schedule's are allowed ... We are
> basically in the middle of the scheduler here, so I wonder how much of
> the scheduler itself can be preempted or so ...
>
Not much. schedule() has a small preempt window at the beginning
and end of the function.
The context switch is of course run with preempt disabled. Ie.
your switch_to should never get preempted.
> Basically, under which circumstances can prev and current be different ?
>
Depends on your context switch, really. prev == current before you
switch, and when you switch to 'new' it is different. However, I think
the 'new' current has *its* old prev on the stack (which == new
current). You just have to preserve the old 'prev' somehow (ie. the
thread you switched away from).
--
SUSE Labs, Novell Inc.
next prev parent reply other threads:[~2005-04-19 1:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-18 19:38 Linas Vepstas
2005-04-19 1:01 ` Benjamin Herrenschmidt
2005-04-19 17:39 ` Linas Vepstas
2005-04-19 1:07 ` Benjamin Herrenschmidt
2005-04-19 1:25 ` Nick Piggin [this message]
2005-04-19 17:22 ` Linas Vepstas
2005-04-20 5:44 ` Benjamin Herrenschmidt
2005-05-05 21:57 ` Linas Vepstas
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=1113873915.5074.6.camel@npiggin-nld.site \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=anton@samba.org \
--cc=benh@kernel.crashing.org \
--cc=linas@austin.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc64-dev@ozlabs.org \
--cc=paulus@samba.org \
/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®