linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Andrew Volkov <Andrew.Volkov@transas.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: PROBLEM: possible proceses leak
Date: Mon, 8 Dec 2003 11:08:27 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.58.0312081106150.13236@home.osdl.org> (raw)
In-Reply-To: <2E74F312D6980D459F3A05492BA40F8D0391B0E9@clue.transas.com>



On Mon, 8 Dec 2003, Andrew Volkov wrote:
>
> In all kernels (up to 2.6-test11) next sequence of code
> in __down/__down_interruptible function
> (arch/i386/kernel/semaphore.c) may cause processes or threads leaking.

Nope. Quite the reverse, in fact. Having the "state" setting above the
wait-queue is usually a good idea, since it means that there are less
races to worry about.

> |-----tsk->state = TASK_UNINTERRUPTIBLE;		<----- BUG:
> |          -- If "do_schedule" from kernel/schedule will calling
> |              at this point, due to expire of time slice,
> |              then current task will removed from run_queue,
> | 		   but doesn't added to any waiting queue, and hence
> |	         will never run again. --

No.

Kernel preemption is special, and it will preempt the process WITHOUT
CHANGING the state of it. See the PREEMPT_ACTIVE test in schedule(). The
process will still be left on the run-queue, and it will be run again,
even if it is marked sleeping.

		Linus

  parent reply	other threads:[~2003-12-08 19:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-08 18:01 PROBLEM: possible proceses leak Andrew Volkov
2003-12-08 18:25 ` William Lee Irwin III
2003-12-08 19:08 ` Linus Torvalds [this message]
2003-12-08 18:45 Andrew Volkov
2003-12-08 18:51 ` William Lee Irwin III
2003-12-08 19:09   ` Linus Torvalds
2003-12-08 19:23     ` William Lee Irwin III
2003-12-08 19:34 Andrew Volkov

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=Pine.LNX.4.58.0312081106150.13236@home.osdl.org \
    --to=torvalds@osdl.org \
    --cc=Andrew.Volkov@transas.com \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).