Re: [patch 2/4] sched/mmcid: Protect transition on weakly ordered systems
From: Thomas Gleixner
Date: Fri Jan 30 2026 - 11:16:36 EST
On Fri, Jan 30 2026 at 10:36, Mathieu Desnoyers wrote:
> On 2026-01-29 16:20, Thomas Gleixner wrote:
> [...]
>>
>> -static void mm_cid_fixup_tasks_to_cpus(void)
>> +static void mm_cid_do_fixup_tasks_to_cpus(struct mm_struct *mm)
>> {
>> - struct mm_struct *mm = current->mm;
>> struct task_struct *p, *t;
>> unsigned int users;
>>
>> @@ -10590,6 +10598,15 @@ static void mm_cid_fixup_tasks_to_cpus(v
>> }
>> }
>>
>> +static void mm_cid_fixup_tasks_to_cpus(void)
>> +{
>> + struct mm_struct *mm = current->mm;
>> +
>> + mm_cid_do_fixup_tasks_to_cpus(mm);
>> + /* Clear the transition bit in the mode */
>> + WRITE_ONCE(mm->mm_cid.mode, MM_CID_ONCPU);
>
> I'm missing something here. Why not just move this write once
> to the end of cid_fixup_tasks_to_cpus ? Why the "do" wrapper
> that has a single caller ?
because do_fixup() has a pile of return points and the wrapper avoids
the otherwise required goto mess.