[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/5 gnumach] sched_prim.c: Split bound processor case into tw
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 1/5 gnumach] sched_prim.c: Split bound processor case into two |
Date: |
Tue, 22 Aug 2023 23:20:45 +0200 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
What improvement do we actually get here? Only avoiding locking the
processor? That does not seems to me worth making the code yet longer.
Samuel
Damien Zammit, le mer. 16 août 2023 01:48:55 +0000, a ecrit:
> ---
> kern/sched_prim.c | 32 ++++++++++++++++++++++++++------
> 1 file changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/kern/sched_prim.c b/kern/sched_prim.c
> index be34e7dd..d69e4990 100644
> --- a/kern/sched_prim.c
> +++ b/kern/sched_prim.c
> @@ -1325,12 +1325,33 @@ void thread_setrun(
> }
> else {
> /*
> - * Bound, can only run on bound processor. Have to lock
> - * processor here because it may not be the current one.
> + * Bound, can only run on bound processor.
> + * Check two cases, bound is current or not.
> */
> - if (processor->state == PROCESSOR_IDLE) {
> +#if MACH_HOST
> + pset = processor->processor_set;
> +#else
> + pset = &default_pset;
> +#endif /* MACH_HOST */
> + if (processor == current_processor()) {
> + if (processor->state == PROCESSOR_IDLE) {
> + simple_lock(&pset->idle_lock);
> + if (processor->state == PROCESSOR_IDLE) {
> + queue_remove(&pset->idle_queue, processor,
> + processor_t, processor_queue);
> + pset->idle_count--;
> + processor->next_thread = th;
> + processor->state = PROCESSOR_DISPATCHING;
> + simple_unlock(&pset->idle_lock);
> + /* Interrupt self */
> + cause_ast_check(processor);
> + return;
> + }
> + simple_unlock(&pset->idle_lock);
> + }
> + }
> + else {
> processor_lock(processor);
> - pset = processor->processor_set;
> simple_lock(&pset->idle_lock);
> if (processor->state == PROCESSOR_IDLE) {
> queue_remove(&pset->idle_queue, processor,
> @@ -1340,8 +1361,7 @@ void thread_setrun(
> processor->state = PROCESSOR_DISPATCHING;
> simple_unlock(&pset->idle_lock);
> processor_unlock(processor);
> - if (processor != current_processor())
> - cause_ast_check(processor);
> + cause_ast_check(processor);
> return;
> }
> simple_unlock(&pset->idle_lock);
> --
> 2.40.1
>
>
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.
- [PATCH 0/5 gnumach] Scheduler fixes, Damien Zammit, 2023/08/15
- [PATCH 2/5 gnumach] sched_prim.c: Set quantum based on priority policy (not minimum), Damien Zammit, 2023/08/15
- [PATCH 1/5 gnumach] sched_prim.c: Split bound processor case into two, Damien Zammit, 2023/08/15
- Re: [PATCH 1/5 gnumach] sched_prim.c: Split bound processor case into two,
Samuel Thibault <=
- [PATCH 3/5 gnumach] sched_prim.c: Add missing MACH_HOST pset conditionals, Damien Zammit, 2023/08/15
- [PATCH 4/5 gnumach] sched_prim.c: Lock thread when calling thread_setrun, Damien Zammit, 2023/08/15
- [PATCH 5/5 gnumach] sched_prim.c: Check all run queues not just master processor, Damien Zammit, 2023/08/15