Re: How to sleep a kernel thread?

From: Francis GALIEGUE (fg@mandrakesoft.com)
Date: Sat Jun 03 2000 - 02:49:02 EDT

  • Next message: Alexander Viro: "Re: Loopback (dir->dir) mounting (NOT -o loop)"

    On Fri, 2 Jun 2000, Matthew Dharm wrote:

    > Hi! I'm working on the usb mass storage support for linux. For this, we
    > have a kernel thread which blocks on a semaphore (used to indicate the
    > number of commands in the queue).
    >
    > The problem is, when I block on the semaphore, the process is still marked
    > as runnable, and thus drives the load average up to 1.00. How do I sleep
    > so that I don't drive up the load? Or how do I mark the process as
    > sleeping on a semaphore for the purposes of load average calculation?
    >

    [ actually, I don't really know anything about kernel threads but ] my first
    guess is that blocking on a semaphore from a kernel thread doesn't set the task
    state to TASK_{UN,}INTERRUPTIBLE, this is why it keeps running.

    Can you use spinlocks in kernel threads? If yes, /methinks this is what you
    should use. My $0.02. Indeed, I'd appreciate being corrected.

    -- 
    fg
    

    "You can tune a filesystem but you can't tuna fish" (HP/UX' fsck manpage)

    - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Sat Jun 03 2000 - 02:55:30 EDT