lkml.org 
[lkml]   [2007]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH -mm 3/7] Freezer: Remove PF_NOFREEZE from rcutorture thread
    On 03/02, Paul E. McKenney wrote:
    >
    > On Sat, Mar 03, 2007 at 02:33:37AM +0300, Oleg Nesterov wrote:
    > > On 03/02, Paul E. McKenney wrote:
    > > >
    > > > One way to embed try_to_freeze() into kthread_should_stop() might be
    > > > as follows:
    > > >
    > > > int kthread_should_stop(void)
    > > > {
    > > > if (kthread_stop_info.k == current)
    > > > return 1;
    > > > try_to_freeze();
    > > > return 0;
    > > > }
    > >
    > > I think this is dangerous. For example, worker_thread() will probably
    > > need some special actions after return from refrigerator. Also, a kernel
    > > thread may check kthread_should_stop() in the place where try_to_freeze()
    > > is not safe.
    > >
    > > Perhaps we should introduce a new helper which does this.
    >
    > Good point -- the return value from try_to_freeze() is lost if one uses
    > the above approach. About one third of the calls to try_to_freeze()
    > in 2.6.20 pay attention to the return value.
    >
    > One approach would be to have a kthread_should_stop_nofreeze() for those
    > cases, and let the default be to try to freeze.

    I personally think we should do the opposite, add kthread_should_stop_check_freeze()
    or something. kthread_should_stop() is like signal_pending(), we can use
    it under spin_lock (and it is probably used this way by some out-of-tree
    driver). The new helper is obviously "might_sleep()".

    Oleg.

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

    \
     
     \ /
      Last update: 2007-03-03 18:37    [W:0.023 / U:0.200 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site