sched_ext: use msecs_to_jiffies consistently
PATCH 1/1 sched_ext: use msecs_to_jiffies consistently
The watchdog's timeout is processed by msecs_to_jiffies when it is checked, but not when the delay for running the watchdog is set. The watchdog will thus run at a time that is later than that time at which it is checked that it has run, and the scheduler aborts.
Add the needed calls to msecs_to_jiffies.
---
Another solution would be to use jiffies everywhere.
kernel/sched/ext.c +6 -4
@@ -1626,6 +1626,7 @@ static bool check_rq_for_timeouts(struct rq *rq)static void scx_check_timeout_workfn (struct work_struct *work) {int cpu; +unsigned long timeout; last_timeout_check = jiffies;for_each_online_cpu (cpu) {
@@ -1634,8 +1635,8 @@ static void scx_check_timeout_workfn(struct work_struct *work)cond_resched (); } -queue_delayed_work (system_unbound_wq,to_delayed_work (work), - task_runnable_timeout_ms /2 ); + timeout =msecs_to_jiffies (task_runnable_timeout_ms); +queue_delayed_work (system_unbound_wq,to_delayed_work (work), timeout /2 ); }static void task_tick_scx (struct rq *rq,struct task_struct *curr,int queued)
@@ -2590,6 +2591,7 @@ static int scx_ops_enable(struct sched_ext_ops *ops) {struct scx_task_iter sti;struct task_struct *p; +unsigned long timeout;int i, ret;mutex_lock (&scx_ops_enable_mutex);
@@ -2674,8 +2676,8 @@ static int scx_ops_enable(struct sched_ext_ops *ops) } last_timeout_check = jiffies; -queue_delayed_work (system_unbound_wq, &check_timeout_work, - task_runnable_timeout_ms /2 ); + timeout =msecs_to_jiffies (task_runnable_timeout_ms); +queue_delayed_work (system_unbound_wq, &check_timeout_work, timeout /2 );/* * Lock out forks, cgroup on/offlining and moves before opening the
Quoted 5 lines · Julia Lawall
The watchdog's timeout is processed by
msecs_to_jiffieswhen it is checked, but not when the delay for running the watchdog is set. The watchdog will thus run at a time that is later than that time at which it is checked that it has run, and the scheduler aborts.
Quoted 7 lines
Add the needed calls to
msecs_to_jiffies.Signed-off-by Julia Lawall <[email protected]>---
Another solution would be to use jiffies everywhere.
Yeah, that was how David Vernet implemented it in the first place and I insisted on using non-jiffies unit, which clearly seems like a mistake. I think the right thing to do here is using jiffies for everything.
Thanks.
Signature · 1 line
tejun