lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.22.394.2212112334020.29296@hadrien>
Date:   Sun, 11 Dec 2022 23:43:30 +0100 (CET)
From:   Julia Lawall <julia.lawall@...ia.fr>
To:     Tejun Heo <tj@...nel.org>
cc:     torvalds@...ux-foundation.org, mingo@...hat.com,
        peterz@...radead.org, juri.lelli@...hat.com,
        vincent.guittot@...aro.org, dietmar.eggemann@....com,
        rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
        bristot@...hat.com, vschneid@...hat.com, ast@...nel.org,
        daniel@...earbox.net, andrii@...nel.org, martin.lau@...nel.org,
        joshdon@...gle.com, brho@...gle.com, pjt@...gle.com,
        derkling@...gle.com, haoluo@...gle.com, dvernet@...a.com,
        dschatzberg@...a.com, dskarlat@...cmu.edu, riel@...riel.com,
        linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
        kernel-team@...a.com
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@...ia.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ