Fix test of "make sure to context-switch to idle thread when therad's status is PS_EXITED"

Change-Id: I62ea813656805b6250b0465853e8fa2918b0c86b
Refs: #1029
Refs: #1227
This commit is contained in:
Masamichi Takagi
2018-11-30 12:57:11 +09:00
parent 6b293409e5
commit dbe5e99cf9
3 changed files with 12 additions and 11 deletions

View File

@ -16,14 +16,6 @@ diff --git kernel/process.c kernel/process.c
index 3dda3ea..eb65aa9 100644
--- kernel/process.c
+++ kernel/process.c
@@ -126,6 +126,7 @@ init_process(struct process *proc, struct process *parent)
proc->mpol_threshold = parent->mpol_threshold;
memcpy(proc->rlimit, parent->rlimit,
sizeof(struct rlimit) * MCK_RLIM_MAX);
+#define POSTK_DEBUG_TEMP_FIX_69 1 // TestCode for #1029
#ifdef POSTK_DEBUG_TEMP_FIX_69 /* Fix problem not to inherit parent cpu_set. */
memcpy(&proc->cpu_set, &parent->cpu_set,
sizeof(proc->cpu_set));
@@ -3135,12 +3136,16 @@ out_schedule:
schedule();
}
@ -41,7 +33,7 @@ index 3dda3ea..eb65aa9 100644
if (cpu_local_var(no_preempt)) {
kprintf("%s: WARNING can't schedule() while no preemption, cnt: %d\n",
@@ -3173,6 +3178,62 @@ redo:
@@ -3173,6 +3178,70 @@ redo:
}
}
@ -58,6 +50,14 @@ index 3dda3ea..eb65aa9 100644
+ if (thread->tid == prev->tid) {
+ continue;
+ }
+
+ /* Skip not-schedulable */
+ if (thread->status == PS_RUNNING ||
+ (thread->status == PS_INTERRUPTIBLE && hassigpending(thread))) {
+ } else {
+ continue;
+ }
+
+ runq_cnt++;
+ if (!thread->started) {
+ not_started = 1;

View File

@ -1,5 +1,6 @@
include $(HOME)/.mck_test_config.mk
CC=gcc
MCK_DIR=/home/satoken/ppos
MCEXEC=$(MCK_DIR)/bin/mcexec
TARGET=sched_test go_test
all:: $(TARGET)

View File

@ -23,7 +23,7 @@ runqに積まれている実行待ちthreadの状態の組み合わせで、12
(2) テストの実行方法
以下の手順でテストを実行する
1. 1029.patch をMcKernelのソースコードに適用し、ビルドとインストールを行う
2. MakefileのMCK_DIR変数の内容を、McKernelがインストールされているディレクトリに変更する
2. ${HOME}/.mck_test_config.mkのMCK_DIR変数の内容を、McKernelがインストールされているディレクトリに変更する
3. <mckernel-install>/bin/mcreboot.sh -c 2-7 -m 2G -O
4. sh make test を実行する