From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163056AbdEYO5I (ORCPT ); Thu, 25 May 2017 10:57:08 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:50630 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966953AbdEYO47 (ORCPT ); Thu, 25 May 2017 10:56:59 -0400 To: Tejun Heo , Lai Jiangshan , linux-kernel@vger.kernel.org Cc: Nathan Fontenot From: Michael Bringmann Subject: [PATCH V2] workqueue: Ensure that cpumask set for pools created after boot Organization: IBM Linux Technology Center Date: Thu, 25 May 2017 09:55:10 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17052514-0052-0000-0000-0000020AC0D4 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007116; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000212; SDB=6.00865478; UDB=6.00429749; IPR=6.00645255; BA=6.00005374; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015581; XFM=3.00000015; UTC=2017-05-25 14:55:14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17052514-0053-0000-0000-000050B564E9 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-25_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705250282 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On NUMA systems with dynamic processors, the content of the cpumask may change over time. As new processors are added via DLPAR operations, workqueues are created for them. This patch ensures that the pools created for new workqueues will be initialized with a cpumask before the first worker is created, attached, and woken up. If the mask is not set up, then the kernel will crash when 'wakeup_process' is unable to find a valid CPU to which to assign the new worker. Signed-off-by: Michael Bringmann --- Changes in V2: -- Only fill in empty cpumasks. --- kernel/workqueue.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c74bf39..1b16ac4 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -3366,6 +3366,9 @@ static struct worker_pool *get_unbound_pool(const struct workqueue_attrs *attrs) copy_workqueue_attrs(pool->attrs, attrs); pool->node = target_node; + if (!cpumask_weight(pool->attrs->cpumask)) + cpumask_copy(pool->attrs->cpumask, cpumask_of(smp_processor_id())); + /* * no_numa isn't a worker_pool attribute, always clear it. See * 'struct workqueue_attrs' comments for detail.