lkml.org 
[lkml]   [2012]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH] kthread: Implement park/unpark facility
    Date
    On Tue, 5 Jun 2012 15:41:48 +0200 (CEST), Thomas Gleixner <tglx@linutronix.de> wrote:
    > Subject: kthread: Implement park/unpark facility
    > From: Thomas Gleixner <tglx@linutronix.de>
    > Date: Wed, 18 Apr 2012 16:37:40 +0200
    >
    > To avoid the full teardown/setup of per cpu kthreads in the case of
    > cpu hot(un)plug, provide a facility which allows to put the kthread
    > into a park position and unpark it when the cpu comes online again.

    Like the idea, but the API is awkward. Now you've made returning from a
    thread do different things depending on whether it was parked or not.

    How about just have the thread call "kthread_parkme()" which only
    returns if/when the thread is unparked?

    So the thread does:

    while (!kthread_should_stop()) {
    if (kthread_should_park()) {
    ... cleanup ...
    kthread_parkme();
    ... restore ...
    }
    ... work ...
    }

    Threads which never exit have "for (;;)" instead of while
    (!kthread_should_stop()).

    Cheers,
    Rusty.


    \
     
     \ /
      Last update: 2012-06-10 09:21    [W:0.024 / U:152.508 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site