From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753595AbdEJQsX (ORCPT ); Wed, 10 May 2017 12:48:23 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45434 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750711AbdEJQsV (ORCPT ); Wed, 10 May 2017 12:48:21 -0400 To: Tejun Heo , Lai Jiangshan , linux-kernel@vger.kernel.org Cc: Nathan Fontenot , Michael Bringmann From: Michael Bringmann Subject: [PATCH] workqueue: Ensure that cpumask set for pools created after boot Organization: IBM Linux Technology Center Date: Wed, 10 May 2017 11:48:17 -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: 17051016-0012-0000-0000-000014359723 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007043; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000210; SDB=6.00858740; UDB=6.00425530; IPR=6.00638213; BA=6.00005342; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015397; XFM=3.00000015; UTC=2017-05-10 16:48:19 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17051016-0013-0000-0000-00004D9965A4 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-10_13:,, 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-1705100114 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 --- diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c74bf39..6091069 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -3366,6 +3366,8 @@ static struct worker_pool *get_unbound_pool(const struct workqueue_attrs *attrs) copy_workqueue_attrs(pool->attrs, attrs); pool->node = target_node; + 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.