PCI: rockchip: fix wrong clr for phy interrupt
[firefly-linux-kernel-4.4.55.git] / kernel / freezer.c
index bd733f6e610d053fbe857aca9828a9c9a8e30706..a8900a3bc27a895b65580a23a144e581bfe0149d 100644 (file)
@@ -39,7 +39,7 @@ static DEFINE_SPINLOCK(freezer_lock);
  */
 bool freezing_slow_path(struct task_struct *p)
 {
-       if (p->flags & PF_NOFREEZE)
+       if (p->flags & (PF_NOFREEZE | PF_SUSPEND_TASK))
                return false;
 
        if (test_thread_flag(TIF_MEMDIE))
@@ -119,6 +119,18 @@ bool freeze_task(struct task_struct *p)
 {
        unsigned long flags;
 
+       /*
+        * This check can race with freezer_do_not_count, but worst case that
+        * will result in an extra wakeup being sent to the task.  It does not
+        * race with freezer_count(), the barriers in freezer_count() and
+        * freezer_should_skip() ensure that either freezer_count() sees
+        * freezing == true in try_to_freeze() and freezes, or
+        * freezer_should_skip() sees !PF_FREEZE_SKIP and freezes the task
+        * normally.
+        */
+       if (freezer_should_skip(p))
+               return false;
+
        spin_lock_irqsave(&freezer_lock, flags);
        if (!freezing(p) || frozen(p)) {
                spin_unlock_irqrestore(&freezer_lock, flags);
@@ -138,12 +150,6 @@ void __thaw_task(struct task_struct *p)
 {
        unsigned long flags;
 
-       /*
-        * Clear freezing and kick @p if FROZEN.  Clearing is guaranteed to
-        * be visible to @p as waking up implies wmb.  Waking up inside
-        * freezer_lock also prevents wakeups from leaking outside
-        * refrigerator.
-        */
        spin_lock_irqsave(&freezer_lock, flags);
        if (frozen(p))
                wake_up_process(p);