Repos / kernel.git / commitdiff
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9bd8423)
raw | patch | inline | side by side (parent: 9bd8423)
| author | zhaoyanbai <zhaoyanbai@126.com> | |
| Fri, 5 Nov 2021 07:03:35 +0000 (15:03 +0800) | ||
| committer | zhaoyanbai <zhaoyanbai@126.com> | |
| Fri, 5 Nov 2021 07:03:35 +0000 (15:03 +0800) |
| include/task.h | patch | blob | history | |
| kernel/init.c | patch | blob | history | |
| kernel/sched.c | patch | blob | history |
diff --git a/include/task.h b/include/task.h
--- a/include/task.h
+++ b/include/task.h
wait_queue_head_t wait;
+ unsigned int sched_cnt;
+
unsigned int cnt; // debug only
};
diff --git a/kernel/init.c b/kernel/init.c
--- a/kernel/init.c
+++ b/kernel/init.c
void user_task_entry(char *name) {
strcpy(current->name, name);
+ current->priority = 90;
+
unsigned long ring3_text_page = va2pa(ring3_entry);
unsigned long ring3_bss_page = va2pa(alloc_one_page(0));
// 赋予不同的优先级
current->priority = id * 30;
+
if (current->priority <= 0) {
current->priority = 1;
}
kernel_task("user", user_task_entry);
int cnt = 0;
+
while (1) {
// sysc_test();
// printl(MPL_TASK_0, "root:0 [%08x] weight %d cnt %d", current, root_task.weight, cnt++);
diff --git a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c
+++ b/kernel/sched.c
if (prev != next) {
// printk("switch to: %s:%d\n", next->name, next->pid);
-
+ sel->sched_cnt++;
list_for_each_safe(pos, t, &all_tasks) {
p = list_entry(pos, task_union, list);
- printl(MPL_TASK_0 + p->pid, "%s%4s:%d [%08x] state %s weight %03d cnt %u", sel == p ? ">" : " ", p->name,
- p->pid, p, task_state(p->state), p->weight, p->cnt);
+ printl(MPL_TASK_0 + p->pid, "%s%4s:%d [%08x] state %s weight %03d sched %u", sel == p ? ">" : " ", p->name,
+ p->pid, p, task_state(p->state), p->weight, p->sched_cnt);
}
context_switch(prev, next);
}