Re: git: 6cbc4ceb7aa0 - main - sched_ule: Use the correct atomic_load variant for tdq_lowpri

From: Mark Johnston <markj_at_freebsd.org>
Date: Fri, 15 Jul 2022 22:26:45 UTC
On Thu, Jul 14, 2022 at 09:50:19PM +0200, Mateusz Guzik wrote:
> On 7/14/22, Mark Johnston <markj@freebsd.org> wrote:
> > The branch main has been updated by markj:
> >
> > URL:
> > https://cgit.FreeBSD.org/src/commit/?id=6cbc4ceb7aa0042e969be7c782436391c579cc3a
> >
> > commit 6cbc4ceb7aa0042e969be7c782436391c579cc3a
> > Author:     Mark Johnston <markj@FreeBSD.org>
> > AuthorDate: 2022-07-14 19:34:02 +0000
> > Commit:     Mark Johnston <markj@FreeBSD.org>
> > CommitDate: 2022-07-14 19:34:02 +0000
> >
> >     sched_ule: Use the correct atomic_load variant for tdq_lowpri
> >
> >     Reported by:    tuexen
> >     Fixes:  11484ad8a2b0 ("sched_ule: Use explicit atomic accesses for tdq
> > fields")
> > ---
> >  sys/kern/sched_ule.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
> > index d23e43a2fbcb..14d6e689081d 100644
> > --- a/sys/kern/sched_ule.c
> > +++ b/sys/kern/sched_ule.c
> > @@ -1360,7 +1360,7 @@ sched_pickcpu(struct thread *td, int flags)
> >  	 * expired and it is idle, run it there.
> >  	 */
> >  	if (THREAD_CAN_SCHED(td, ts->ts_cpu) &&
> > -	    atomic_load_int(&tdq->tdq_lowpri) >= PRI_MIN_IDLE &&
> > +	    atomic_load_char(&tdq->tdq_lowpri) >= PRI_MIN_IDLE &&
> 
> this reminds me that someone(tm) should add type checking to these

Here's an attempt at that: https://reviews.freebsd.org/D35828