All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Yuly Finkelberg <liquidicecube@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Scheduler: Spinning until tasks are STOPPED
Date: Mon, 09 May 2005 16:05:15 +1000	[thread overview]
Message-ID: <427EFD9B.7010808@yahoo.com.au> (raw)
In-Reply-To: <92df317505050817071d852623@mail.gmail.com>

Yuly Finkelberg wrote:
>>Well it still sounds like the kernel is doing too much. For example,
>>why don't you just have a syscall (or char device) just to send out
>>the events, and do everything else (all the queueing and
>>synchronisation and signalling) in userspace?
> 
> 
> True, it does :)
> However, the operation requires that a consistent in-kernel state will
> hold for the tasks.  They all (except for the last one) do some work,
> send a SIGSTOP to themselves, and return to usermode (handling the
> STOP signal).  The last task does not stop itself, but instead
> verifies that all of the others are stopped before it returns.
> 

Well you can do that all from userspace basically.
At least you should be able to do it as well as you can from
kernel (providing you have a syscall/device to retrieve events).

> 
>>OK, for a simple example, instead of spinning on yield(), do a
>>down() on a locked mutex.
>>Then have maybe an `atomic_t nr_running` which is incremented for
>>each worker task running. When they are ready to stop, they can
>>do an atomic_dec_and_test of nr_running, and the last one can up()
>>the mutex. If you absolutely need to know when the process is
>>actually stopped, why?
> 
> 
> I need to ensure that the internal state of the processes will not
> change (unless of course some other signal gets delivered, which will
> not be the case).
> 

They won't change *much*. Nothing that is detectable from userspace
(except for perhaps /proc entries).

> It doesn't look like the problem is with the task that is spinning
> until the others have stopped.  Instead, it looks like one of the
> other tasks is spinning somewhere in between the time that it wakes up
> its successor and the time that it sends it self the STOP signal.  It
> is clearly getting preempted but then makes no progress (sometimes for
> a VERY long time).
> 

Well it is a bit difficult to help further because you haven't posted
the working code or said what you are trying to do.

Stick a few printks around the place or try a kernel debugger to see
if you can't work out what is going wrong. Compiling the kernel with
debug info can allow you to find out what line of code EIP is pointing
to, which can also be helpful.

-- 
SUSE Labs, Novell Inc.


  parent reply	other threads:[~2005-05-09  6:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-07  6:31 Scheduler: Spinning until tasks are STOPPED Yuly Finkelberg
2005-05-07  7:12 ` Nick Piggin
2005-05-07 17:36   ` Yuly Finkelberg
2005-05-08  4:00     ` Nick Piggin
2005-05-09  0:10       ` Yuly Finkelberg
     [not found]       ` <92df317505050817071d852623@mail.gmail.com>
2005-05-09  6:05         ` Nick Piggin [this message]
     [not found] <41r8S-6Y0-13@gated-at.bofh.it>
     [not found] ` <41rLz-7zl-5@gated-at.bofh.it>
     [not found]   ` <41BrD-79c-29@gated-at.bofh.it>
2005-05-07 22:38     ` Bodo Eggert <harvested.in.lkml@posting.7eggert.dyndns.org>

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=427EFD9B.7010808@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liquidicecube@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.