mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-23 16:23:24 +00:00
修改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:
@ -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))
|
||||
{
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user