sched: Change wait_task_inactive()s match_state
[sfrench/cifs-2.6.git] / kernel / sched / core.c
index 163018105bf8d47cc63e1932700877fae0d45837..43d71c69612540501a72ec8557b0efa88abff089 100644 (file)
@@ -3294,7 +3294,7 @@ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state
                 * is actually now running somewhere else!
                 */
                while (task_on_cpu(rq, p)) {
-                       if (match_state && unlikely(READ_ONCE(p->__state) != match_state))
+                       if (match_state && !(READ_ONCE(p->__state) & match_state))
                                return 0;
                        cpu_relax();
                }
@@ -3309,7 +3309,7 @@ unsigned long wait_task_inactive(struct task_struct *p, unsigned int match_state
                running = task_on_cpu(rq, p);
                queued = task_on_rq_queued(p);
                ncsw = 0;
-               if (!match_state || READ_ONCE(p->__state) == match_state)
+               if (!match_state || (READ_ONCE(p->__state) & match_state))
                        ncsw = p->nvcsw | LONG_MIN; /* sets MSB */
                task_rq_unlock(rq, p, &rf);