[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251020091601.GH3245006@noisy.programming.kicks-ass.net>
Date: Mon, 20 Oct 2025 11:16:01 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Gabriele Monaco <gmonaco@...hat.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Michael Jeanson <mjeanson@...icios.com>,
Jens Axboe <axboe@...nel.dk>,
"Paul E. McKenney" <paulmck@...nel.org>,
"Gautham R. Shenoy" <gautham.shenoy@....com>,
Florian Weimer <fweimer@...hat.com>,
Tim Chen <tim.c.chen@...el.com>,
TCMalloc Team <tcmalloc-eng@...gle.com>
Subject: Re: [patch 16/19] sched/mmcid: Provide CID ownership mode fixup
functions
On Wed, Oct 15, 2025 at 07:29:54PM +0200, Thomas Gleixner wrote:
> +static void __maybe_unused mm_cid_fixup_cpus_to_tasks(struct mm_struct *mm)
> +{
> + unsigned int cpu;
Alternatively you could take cpus_read_lock() and iterate online_cpus().
No offline CPU should be running a userspace task and all that.
Doesn't really matter much, this also works fine.
> + /* Walk the CPUs and fixup all stale CIDs */
> + for_each_possible_cpu(cpu) {
> + struct mm_cid_pcpu *pcp = per_cpu_ptr(mm->mm_cid.pcpu, cpu);
> + struct rq *rq = cpu_rq(cpu);
> +
> + /* Remote access to mm::mm_cid::pcpu requires rq_lock */
> + guard(rq_lock_irq)(rq);
> + if (cid_on_cpu(pcp->cid)) {
> + /* If rq->curr has @mm, fix it up right here */
> + if (rq->curr->mm == mm && rq->curr->mm_cid.active)
> + mm_cid_transfer_to_task(rq->curr, pcp);
> + else
> + mm_drop_cid_on_cpu(mm, pcp);
> + }
> + }
> +}
Powered by blists - more mailing lists