[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZifdfQ_vjqGqNdPk@slm.duckdns.org>
Date: Tue, 23 Apr 2024 06:10:37 -1000
From: Tejun Heo <tj@...nel.org>
To: Lai Jiangshan <jiangshanlai@...il.com>
Cc: linux-kernel@...r.kernel.org, Sam Sun <samsun1006219@...il.com>,
xingwei lee <xrivendell7@...il.com>,
syzkaller-bugs@...glegroups.com,
Lai Jiangshan <jiangshan.ljs@...group.com>, stable@...r.kernel.org
Subject: Re: [PATCH] workqueue: Fix divide error in
wq_update_node_max_active()
Hello, Lai.
On Tue, Apr 23, 2024 at 08:45:48PM +0800, Lai Jiangshan wrote:
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 0066c8f6c154..b31cd7faeb9f 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -1591,7 +1591,7 @@ static void wq_update_node_max_active(struct workqueue_struct *wq, int off_cpu)
> off_cpu = -1;
>
> total_cpus = cpumask_weight_and(effective, cpu_online_mask);
> - if (off_cpu >= 0)
> + if (off_cpu >= 0 && total_cpus > 1)
> total_cpus--;
Can we do this explicitly instead? ie. test total_cpus before using it as
divisor and use max_active explicitly if it's zero.
Thanks.
--
tejun
Powered by blists - more mailing lists