hrtimer.c : Remove redundant thread state settings
PATCH 1/1 hrtimer.c : Remove redundant thread state settings
After a thread is awakened, its state is already task_running
--- kernel/time/hrtimer.c | 2 -- 1 file changed, 2 deletions(-)
kernel/time/hrtimer.c +0 -2
@@ -2310,8 +2310,6 @@ schedule_hrtimeout_range_clock(ktime_t *expires, u64 delta,hrtimer_cancel (&t.timer);destroy_hrtimer_on_stack (&t.timer); -__set_current_state (TASK_RUNNING ); -return !t.task ?0 : -EINTR ; }EXPORT_SYMBOL_GPL (schedule_hrtimeout_range_clock);
Signature · 1 line
2.25.1
Quoted 1 line · Lizhe
After a thread is awakened, its state is already
task_running
That's correct, but please look at hrtimer_wakeup() and the conditional schedule() invocation in schedule_hrtimeout_range_clock(). You break the guarantee that this function returns with task state == TASK_RUNNING.
Thanks,
tglx
Hi,
Please review this patch, It does not check the condition when executing the scheduler() function.
Lizhe
thanks
Quoted 10 lines · Thomas Gleixner
Quoted 1 line · Lizhe
After a thread is awakened, its state is already
task_runningThat's correct, but please look at
hrtimer_wakeup()and the conditionalschedule()invocation inschedule_hrtimeout_range_clock(). You break the guarantee that this function returns with task state ==TASK_RUNNING.Thanks,
tglx
From 81a6920517e5e2d9ac6f5b3e464b64b550f07049 Mon Sep 17 00:00:00 2001
From: Lizhe <[email protected]>
Date: Thu, 11 Jan 2024 20:57:01 -0800
Subject: [PATCH] drivers/dm-crypt.c : remove redundant state settings after
waking up
The task status has been set to TASK_RUNNING in schedule(). No need to set again here.
--- drivers/md/dm-crypt.c | 1 - 1 file changed, 1 deletion(-)
drivers/md/dm-crypt.c +0 -1
@@ -1948,7 +1948,6 @@ static int dmcrypt_write(void *data)schedule (); -set_current_state (TASK_RUNNING );spin_lock_irq (&cc->write_thread_lock); goto continue_locked;
Signature · 1 line
2.25.1