Skip to content

Commit 829694c

Browse files
authored
Merge pull request #109 from KaiNorberg/develop
fix(kernel:sched): add fallback to first thread in runqueue
2 parents 65b6166 + 123cfd1 commit 829694c

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Will this project ever reach its goals? Probably not, but that's not the point.
8484

8585
## Notable Future Plans
8686

87-
- File servers (FUSE, 9P?).
87+
- Implement 9P file servers. <-- Currently being worked on.
8888
- Implement user system in user-space using namespaces.
8989
- Improve `share()` and `claim()` security by specifying a target PID when sharing.
9090
- Overhaul Desktop Window Manager to use the new security system and file servers?

src/kernel/sched/sched.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,15 +327,19 @@ static thread_t* sched_first_eligible(sched_t* sched)
327327
current = current->children[RBNODE_RIGHT];
328328
}
329329

330-
#ifndef NDEBUG
331330
if (!rbtree_is_empty(&sched->runqueue))
332331
{
332+
#ifndef NDEBUG
333333
vclock_t vminEligible =
334334
CONTAINER_OF_SAFE(rbtree_find_min(sched->runqueue.root), sched_client_t, node)->vminEligible;
335335
panic(NULL, "No eligible threads found, vminEligible=%lld vtime=%lld", SCHED_FIXED_FROM(vminEligible),
336336
SCHED_FIXED_FROM(sched->vtime));
337-
}
337+
#else
338+
LOG_WARN("No eligible threads found, falling back to first thread in runqueue\n");
339+
sched_client_t* first = CONTAINER_OF(rbtree_find_min(sched->runqueue.root), sched_client_t, node);
340+
return CONTAINER_OF(first, thread_t, sched);
338341
#endif
342+
}
339343

340344
thread_t* victim = sched_steal();
341345
if (victim != NULL)

0 commit comments

Comments
 (0)