AIUI in the !MACH_HOST case, myprocessor->processor_set is &default_pset anyway? I'd rather keep the code simpler rather than micro-optimise this.
Samuel Damien Zammit, le mer. 16 août 2023 01:49:14 +0000, a ecrit: > --- > kern/sched_prim.c | 29 +++++++++++++++++++---------- > 1 file changed, 19 insertions(+), 10 deletions(-) > > diff --git a/kern/sched_prim.c b/kern/sched_prim.c > index 5ee0791b..5def77d4 100644 > --- a/kern/sched_prim.c > +++ b/kern/sched_prim.c > @@ -510,6 +510,13 @@ static thread_t thread_select( > processor_t myprocessor) > { > thread_t thread; > + processor_set_t pset; > + > +#if MACH_HOST > + pset = myprocessor->processor_set; > +#else /* MACH_HOST */ > + pset = &default_pset; > +#endif /* MACH_HOST */ > > myprocessor->first_quantum = TRUE; > /* > @@ -520,13 +527,6 @@ static thread_t thread_select( > thread = choose_thread(myprocessor); > } > else { > - processor_set_t pset; > - > -#if MACH_HOST > - pset = myprocessor->processor_set; > -#else /* MACH_HOST */ > - pset = &default_pset; > -#endif /* MACH_HOST */ > simple_lock(&pset->runq.lock); > #if DEBUG > checkrq(&pset->runq, "thread_select"); > @@ -1259,7 +1259,11 @@ void thread_setrun( > /* > * Not bound, any processor in the processor set is ok. > */ > +#if MACH_HOST > pset = th->processor_set; > +#else > + pset = &default_pset; > +#endif /* MACH_HOST */ > #if HW_FOOTPRINT > /* > * But first check the last processor it ran on. > @@ -1543,9 +1547,11 @@ thread_t choose_thread( > /*NOTREACHED*/ > } > simple_unlock(&runq->lock); > - > +#if MACH_HOST > pset = myprocessor->processor_set; > - > +#else > + pset = &default_pset; > +#endif > simple_lock(&pset->runq.lock); > return choose_pset_thread(myprocessor,pset); > } > @@ -1752,8 +1758,11 @@ retry: > } > else if (state == PROCESSOR_IDLE) { > processor_set_t pset; > - > +#if MACH_HOST > pset = myprocessor->processor_set; > +#else > + pset = &default_pset; > +#endif /* MACH_HOST */ > simple_lock(&pset->idle_lock); > if (myprocessor->state != PROCESSOR_IDLE) { > /* > -- > 2.40.1 > > > -- Samuel --- Pour une évaluation indépendante, transparente et rigoureuse ! Je soutiens la Commission d'Évaluation de l'Inria.