Changeset bea6233 in mainline for kernel/generic/src/proc/scheduler.c


Ignore:
Timestamp:
2023-02-26T15:27:13Z (14 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7cf5ddb
Parents:
deed510
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-26 15:18:02)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-26 15:27:13)
Message:

Replace cpu_sleep() with cpu_interruptible_sleep()

The new function combines interrupt reenabling with sleep,
so that a platform can implement this sequence atomically.
This is currently done only on ia32 and amd64.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/scheduler.c

    rdeed510 rbea6233  
    187187
    188188loop:
    189 
    190189        if (atomic_load(&CPU->nrdy) == 0) {
    191190                /*
     
    197196                CPU->idle = true;
    198197                irq_spinlock_unlock(&CPU->lock, false);
    199                 interrupts_enable();
    200198
    201199                /*
    202                  * An interrupt might occur right now and wake up a thread.
    203                  * In such case, the CPU will continue to go to sleep
    204                  * even though there is a runnable thread.
     200                 * Go to sleep with interrupts enabled.
     201                 * Ideally, this should be atomic, but this is not guaranteed on
     202                 * all platforms yet, so it is possible we will go sleep when
     203                 * a thread has just become available.
    205204                 */
    206                 cpu_sleep();
    207                 interrupts_disable();
     205                cpu_interruptible_sleep();
     206
     207                /* Interrupts are disabled again. */
    208208                goto loop;
    209209        }
Note: See TracChangeset for help on using the changeset viewer.