Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ACS
Public
HermitOS
kernel
Commits
1b95902c
Commit
1b95902c
authored
1 year ago
by
Stefan Lankes
Browse files
Options
Downloads
Patches
Plain Diff
simplify check if a task is available
parent
bb70d730
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/scheduler/mod.rs
+10
-15
10 additions, 15 deletions
src/scheduler/mod.rs
with
10 additions
and
15 deletions
src/scheduler/mod.rs
+
10
−
15
View file @
1b95902c
...
...
@@ -517,16 +517,15 @@ impl PerCoreScheduler {
loop
{
interrupts
::
disable
();
if
!
self
.scheduler
()
{
backoff
.reset
()
}
// do housekeeping
let
wakeup_tasks
=
self
.cleanup_tasks
();
let
_
=
self
.cleanup_tasks
();
let
still_idle
=
{
let
status
=
self
.current_task
.borrow
()
.status
;
status
==
TaskStatus
::
Idle
&&
self
.ready_queue
.is_empty
()
};
// Re-enable interrupts and simultaneously set the CPU into the HALT state to only wake up at the next interrupt.
// This atomic operation guarantees that we cannot miss a wakeup interrupt in between.
if
!
wakeup_tasks
{
if
still_idle
{
if
backoff
.is_completed
()
{
interrupts
::
enable_and_wait
();
}
else
{
...
...
@@ -535,15 +534,15 @@ impl PerCoreScheduler {
}
}
else
{
interrupts
::
enable
();
self
.reschedule
();
backoff
.reset
();
}
}
}
/// Triggers the scheduler to reschedule the tasks.
/// Interrupt flag must be cleared before calling this function.
/// Returns `true` if the new and the old task is the idle task,
/// otherwise the function returns `false`.
pub
fn
scheduler
(
&
mut
self
)
->
bool
{
pub
fn
scheduler
(
&
mut
self
)
{
// Someone wants to give up the CPU
// => we have time to cleanup the system
let
_
=
self
.cleanup_tasks
();
...
...
@@ -634,10 +633,6 @@ impl PerCoreScheduler {
}
}
}
false
}
else
{
status
==
TaskStatus
::
Idle
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment