hrtimer.c : Remove redundant thread state settings

Message ID 20240110141349.52718-1-sensor1010@163.com
State New
Headers
Series hrtimer.c : Remove redundant thread state settings |

Commit Message

Lizhe Jan. 10, 2024, 2:13 p.m. UTC
  After a thread is awakened, its state is already task_running

Signed-off-by: Lizhe <sensor1010@163.com>
---
 kernel/time/hrtimer.c | 2 --
 1 file changed, 2 deletions(-)
  

Comments

Thomas Gleixner Jan. 11, 2024, 4:44 p.m. UTC | #1
On Wed, Jan 10 2024 at 06:13, Lizhe wrote:
> 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
  
Lizhe Jan. 12, 2024, 5:03 a.m. UTC | #2
Hi, 
    Please review this patch, It does not check the condition when executing the scheduler() function.
       
                                                                                                       Lizhe
                                                                                           thanks











At 2024-01-12 00:44:20, "Thomas Gleixner" <tglx@linutronix.de> wrote:
>On Wed, Jan 10 2024 at 06:13, Lizhe wrote:
>> 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
  

Patch

diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 760793998cdd..b123e9f4401a 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -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);