Merge branches 'doc.2021.01.06a', 'fixes.2021.01.04b', 'kfree_rcu.2021.01.04a', ...
[sfrench/cifs-2.6.git] / kernel / sched / core.c
index 15d2562118d1727aa197bd5f9cc6314cfebace6c..a75c608839c4d6d52bd80157b85bb98234670091 100644 (file)
@@ -3464,7 +3464,7 @@ out:
 
 /**
  * try_invoke_on_locked_down_task - Invoke a function on task in fixed state
- * @p: Process for which the function is to be invoked.
+ * @p: Process for which the function is to be invoked, can be @current.
  * @func: Function to invoke.
  * @arg: Argument to function.
  *
@@ -3482,12 +3482,11 @@ out:
  */
 bool try_invoke_on_locked_down_task(struct task_struct *p, bool (*func)(struct task_struct *t, void *arg), void *arg)
 {
-       bool ret = false;
        struct rq_flags rf;
+       bool ret = false;
        struct rq *rq;
 
-       lockdep_assert_irqs_enabled();
-       raw_spin_lock_irq(&p->pi_lock);
+       raw_spin_lock_irqsave(&p->pi_lock, rf.flags);
        if (p->on_rq) {
                rq = __task_rq_lock(p, &rf);
                if (task_rq(p) == rq)
@@ -3504,7 +3503,7 @@ bool try_invoke_on_locked_down_task(struct task_struct *p, bool (*func)(struct t
                                ret = func(p, arg);
                }
        }
-       raw_spin_unlock_irq(&p->pi_lock);
+       raw_spin_unlock_irqrestore(&p->pi_lock, rf.flags);
        return ret;
 }