mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: rusty@rustcorp.com.au, linux-kernel@vger.kernel.org
Subject: Re: Unusually long delay in the kernel
Date: Sun, 18 Sep 2005 13:09:02 -0700	[thread overview]
Message-ID: <20050918130902.23a824e0.akpm@osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0509181057570.27009-100000@netrider.rowland.org>

Alan Stern <stern@rowland.harvard.edu> wrote:
>
> On Sat, 17 Sep 2005, Andrew Morton wrote:
> 
>  > > > That code could be converted to the kthread API btw.
>  > > 
>  > > Hmph.  Near as I can tell, the only changes that would involve are:
>  > > 
>  > > 	Converting the thread creation call from kernel_thread to
>  > > 	kthread_run.
>  > > 
>  > > 	Adding another call to wake the thread up once it has been
>  > > 	created.
>  > > 
>  > > 	Removing the call to daemonize.
>  > > 
>  > > There wouldn't be any need to call kthread_stop -- and in fact it wouldn't 
>  > > work, as the thread waits on a semaphore while it is idle (kthread_stop 
>  > > can't cope with things like that).
>  > 
>  > Well I was assuming that the semaphore would go away as well.  Kernel
>  > threads normally use waitqueues to await more work.
> 
>  Some kernel threads have a producer-consumer relationship with their
>  clients, and it's important that they wake exactly once each time they are
>  invoked.  A semaphore is the natural way to manage such a thread, but the
>  kthread API isn't set up to handle such things.  It's possible to make
>  this work, by using a manual poor-man's semaphore implementation, but that
>  seems ridiculous.

OK.

>  Would this patch be acceptable?

Well it makes all kthread_stop() callers pass an additional (unused)
argument.  I'd make kthread_stop() and kthread_stop_sem() real C functions,
hide the code sharing within kthread.c.


  reply	other threads:[~2005-09-18 20:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-16 16:42 Alan Stern
2005-09-16 17:58 ` Fawad Lateef
2005-09-17  6:52 ` Andrew Morton
2005-09-17 22:15   ` Alan Stern
2005-09-17 23:41     ` Andrew Morton
2005-09-18 15:05       ` Alan Stern
2005-09-18 20:09         ` Andrew Morton [this message]
2005-09-19 14:40           ` [Proposed PATCH] Add kthread_stop_sem Alan Stern
2005-09-19 18:06       ` Unusually long delay in the kernel Alan Stern

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=20050918130902.23a824e0.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=stern@rowland.harvard.edu \
    /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®