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@vger.kernel.org
Subject: Re: Scheduler: Spinning until tasks are STOPPED
Date: Sun, 08 May 2005 14:00:03 +1000	[thread overview]
Message-ID: <427D8EC3.9040409@yahoo.com.au> (raw)
In-Reply-To: <92df3175050507103621a88554@mail.gmail.com>

Yuly Finkelberg wrote:
> Nick,
> 
> 
>>You're doing this in the *kernel*? It sounds like it should be done
>>in userspace or done a different way (ie. not with 50 tasks).
> 
> 
> These are tasks that are running in the kernel on behalf of a new system call.  
> 

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?

> 
>>And using signals and spinning on yield for synchronisation and
>>process control in the kernel like this is fairly crazy.
> 
> 
> The problem appears to be not with the process that is
> spinning/yielding, but rather the one process which gets stuck.  It is
> charged almost all the system time.  I agree that it's not pretty
> though...
> 
> 
>>Can't you use a semaphore or something?
> 
> 
> There is noone to call up() when a process is actually stopped.
> 
> If you have any ideas as to what can be happening or a better way to
> accomplish this (in the kernel), I'd appreciate hearing it.
> 

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?

Also, sending one's self a SIGSTOP to stop is not so good.
Generally you shouldn't use signals at all in the kernel if
possible. So why don't those guys just return to usermode and you
can raise a signal or whatever you need from there.

-- 
SUSE Labs, Novell Inc.


  reply	other threads:[~2005-05-08  4:00 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 [this message]
2005-05-09  0:10       ` Yuly Finkelberg
     [not found]       ` <92df317505050817071d852623@mail.gmail.com>
2005-05-09  6:05         ` Nick Piggin
     [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=427D8EC3.9040409@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.