Messages in this thread Patch in this message |  | | Date | Sun, 11 Dec 2022 23:43:30 +0100 (CET) | From | Julia Lawall <> | Subject | [PATCH] 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.
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---
Another solution would be to use jiffies everywhere.
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index a28144220501..9d711a70d996 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -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
|  |