修改CFSqueue从Vec变成红黑树 (#229)

使用了由tickbh编写的rbtree: https://github.com/tickbh/rbtree-rs/blob/master/src/lib.rs

Co-authored-by: tickbh <tickdream125@hotmail.com>
This commit is contained in:
hanjiezhou
2023-04-06 00:50:14 +08:00
committed by GitHub
parent 2a7d773d3d
commit e0dfd4d5d7
11 changed files with 1819 additions and 21 deletions

View File

@ -70,7 +70,8 @@ static struct process_control_block *__kthread_create_on_node(int (*thread_fn)(v
// todo: 使用completion优化这里
while (kthreadd_pcb == NULL) // 若kthreadd未初始化则等待kthreadd启动
;
barrier();
// 唤醒kthreadd守护进程
process_wakeup_immediately(kthreadd_pcb);
@ -213,17 +214,21 @@ int kthreadd(void *unused)
barrier();
kinfo("kthread daemon started!");
struct process_control_block *pcb = current_pcb;
barrier();
kthreadd_pcb = current_pcb;
barrier();
current_pcb->flags |= PF_NOFREEZE;
for (;;)
{
current_pcb->state = PROC_INTERRUPTIBLE;
// 所有的创建任务都被处理完了
if (list_empty(&kthread_create_list))
sched();
spin_lock(&__kthread_create_lock);
// 循环取出链表中的任务
while (!list_empty(&kthread_create_list))
{

View File

@ -603,7 +603,7 @@ ul initial_kernel_thread(ul arg)
"m"(current_pcb->thread->rsp), "m"(current_pcb->thread->rip), "S"("/bin/shell.elf"), "c"(NULL),
"d"(NULL)
: "memory");
return 1;
}
#pragma GCC pop_options