lkml.org 
[lkml]   [2011]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 09/16] freezer: make freezing indicate freeze condition in effect
    On 08/19, Tejun Heo wrote:
    >
    > This patch makes freezing indicate that freeze condition is in effect.
    > A task enters and stays frozen if freezing. This makes PF_FROZEN
    > manipulation done only by the task itself and prevents wakeup from
    > __thaw_task() leaking outside of refrigerator.

    but this looks racy.

    > @@ -44,7 +48,7 @@ bool __refrigerator(bool check_kthr_stop)
    >
    > for (;;) {
    > set_current_state(TASK_UNINTERRUPTIBLE);
    > - if (!frozen(current) ||
    > + if (!freezing(current) ||
    > (check_kthr_stop && kthread_should_stop()))
    > break;
    > was_frozen = true;
    > @@ -54,6 +58,11 @@ bool __refrigerator(bool check_kthr_stop)
    > /* Remove the accounting blocker */
    > current->flags &= ~PF_FREEZING;
    >
    > + /* leave FROZEN */
    > + spin_lock_irq(&freezer_lock);
    > + current->flags &= ~PF_FROZEN;
    > + spin_unlock_irq(&freezer_lock);

    What if freezing() is true again when we are going to clear
    PF_FROZEN?

    In this case the 2nd try_to_freeze_tasks() can see this task
    as already frozen and return success while it is going to run.

    Oleg.



    \
     
     \ /
      Last update: 2011-08-28 20:01    [W:0.020 / U:29.816 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site