On Mon, Apr 03, 2023 at 02:13:42PM -0400, Mathieu Desnoyers wrote:
void sched_mm_cid_exit_signals(struct task_struct *t)
{
struct mm_struct *mm = t->mm;
- unsigned long flags;
+ struct rq_flags rf;
+ struct rq *rq;
if (!mm)
return;
- local_irq_save(flags);
+
+ preempt_disable();
+ rq = this_rq();
+ rq_lock_irqsave(rq, &rf);
mm_cid_put(mm, t->mm_cid);
- t->mm_cid = -1;
+ t->last_mm_cid = t->mm_cid = -1;
t->mm_cid_active = 0;
- local_irq_restore(flags);
+ rq_unlock_irqrestore(rq, &rf);
+ preempt_enable();
}
FWIW a *slightly* cheaper form is:
preempt_disable();
rq = this_rq();
rq_lock_irqsave(rq, &rf);
preempt_enable_noresched(); /* holding spinlock */
...
rq_unlock_irqrestore(rq, &rf);