Re: [PATCH 1/2] sched/membarrier: Use per-CPU mutexes for targeted commands
From: Peter Zijlstra
Date: Tue Apr 28 2026 - 08:37:28 EST
On Fri, Apr 10, 2026 at 11:55:11PM +0000, Aniket Gattani wrote:
> On Fri, 10 Apr 2026 14:56:55 +0200, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> > On Thu, Apr 09, 2026 at 09:22:22PM +0000, Aniket Gattani wrote:
> > > + if (cpu_id >= 0 && (cpu_id >= nr_cpu_ids || !cpu_possible(cpu_id)))
> > > + return 0;
> >
> > Did that want to be:
> >
> > if ((unsigned)cpu_id >= nr_cpu_ids || !cpu_possible(cpu_id))
> >
> > ?
>
> Thanks for the review.
> Agreed. I will fix this in v2 and will wait a couple of business days for anyone else to respond.
Was just looking at v2, and this is terribly broken, sorry for the
suggestion.
membarrier_private_expedited() very much has to deal with cpu_id==-1.