diff options
author | Vincent Chen <vincentc@andestech.com> | 2019-01-03 04:32:33 +0100 |
---|---|---|
committer | Palmer Dabbelt <palmer@sifive.com> | 2019-01-23 21:56:19 +0100 |
commit | 99fd6e875d0c24448a5e2c241422a691be46b241 (patch) | |
tree | 4b253b38db1d5a3653ef38fd01d3fb0599c877de /arch/riscv/kernel/asm-offsets.c | |
parent | Linux 5.0-rc3 (diff) | |
download | linux-99fd6e875d0c24448a5e2c241422a691be46b241.tar.xz linux-99fd6e875d0c24448a5e2c241422a691be46b241.zip |
RISC-V: Add _TIF_NEED_RESCHED check for kernel thread when CONFIG_PREEMPT=y
The cond_resched() can be used to yield the CPU resource if
CONFIG_PREEMPT is not defined. Otherwise, cond_resched() is a dummy
function. In order to avoid kernel thread occupying entire CPU,
when CONFIG_PREEMPT=y, the kernel thread needs to follow the
rescheduling mechanism like a user thread.
Signed-off-by: Vincent Chen <vincentc@andestech.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
Diffstat (limited to 'arch/riscv/kernel/asm-offsets.c')
-rw-r--r-- | arch/riscv/kernel/asm-offsets.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/riscv/kernel/asm-offsets.c b/arch/riscv/kernel/asm-offsets.c index 6a92a2fe198e..dac98348c6a3 100644 --- a/arch/riscv/kernel/asm-offsets.c +++ b/arch/riscv/kernel/asm-offsets.c @@ -39,6 +39,7 @@ void asm_offsets(void) OFFSET(TASK_STACK, task_struct, stack); OFFSET(TASK_TI, task_struct, thread_info); OFFSET(TASK_TI_FLAGS, task_struct, thread_info.flags); + OFFSET(TASK_TI_PREEMPT_COUNT, task_struct, thread_info.preempt_count); OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp); OFFSET(TASK_TI_USER_SP, task_struct, thread_info.user_sp); OFFSET(TASK_TI_CPU, task_struct, thread_info.cpu); |