Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2222621pxu; Fri, 18 Dec 2020 08:13:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwtW8WJXA7EGlxS46TzoRbg2r+W7smWwVxN7WB4o3yjVQlDBbXie4RN/8ZgCWJakrJdMaIC X-Received: by 2002:a17:906:4ec7:: with SMTP id i7mr4794211ejv.252.1608307996094; Fri, 18 Dec 2020 08:13:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608307996; cv=none; d=google.com; s=arc-20160816; b=Pyp/HxDy/MCyx4tSLiDJZFXqvF55vV+8f4DwEFlNOJCr1Hz9AK8ncXg3WvqudRqbzG uVHmDcK7E+r8bCO7WKCfAFJ2vsHD8Z29IFDexZmFYdzTCBrT8vjcLsi/fu9L8bFHofBm FqAqpAtx+S/1BlIuS/gczas6gyYFfPzNLemo8Jl8Yxa9v3RXhhag9S+pSmUejNO7OeWo YfJiPiGoj8sqyBhkZfSB5mKIvZVLV+NJv6gH9e/WZ+M7UWPaCxAEgGLMx/n6c+1FNlb8 B7kcH9RtjNG4kFexPao2ho0fnw7vHX720z6Vo1xKD8L36+nYIiGMWw3TKhY9LLOI9f8R RNjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3BFwltcKlarcNHsBQ5fgE4su5DLlDyOnN0mFp9s/OfE=; b=Fl74o65W4Ddh1sixRS3+LCRBkS8IfXH03bItAFNpiqg29QOcdxS2Rkp8wSKWkoDbSE W15YthDegWEDRK+4JGReowXO0fmJ4mXf12SOBcx20+jvqfKkySxMShjX8Q7IP1TWoZmB ZwwXOOUlT3P6ipy4PLi6vvG+qpYtsK+TNI0Ao8QnDZirgP57WxWsHBWLH5eOaZU2oUmU e8FetNXhJSAMjnQhmfCkeO2H/2I7Dh7Xop0+nwgdPb9HqVZLnMR8vVi+2YuihjizaJIp P3brMy4wYn12djnwyjur66yIc2/HsgAr8pWUNXbwKg5wBXhpMm1CBjfiys8OvvsRmWJE G1jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="kEE7/p0/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s15si4209799ejx.39.2020.12.18.08.12.53; Fri, 18 Dec 2020 08:13:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="kEE7/p0/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726448AbgLRQK7 (ORCPT + 99 others); Fri, 18 Dec 2020 11:10:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725949AbgLRQK7 (ORCPT ); Fri, 18 Dec 2020 11:10:59 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5FCBC0617B0 for ; Fri, 18 Dec 2020 08:10:18 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id e2so1619172plt.12 for ; Fri, 18 Dec 2020 08:10:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3BFwltcKlarcNHsBQ5fgE4su5DLlDyOnN0mFp9s/OfE=; b=kEE7/p0/QAn00j6CWJWn2gHbuV1R4kpLbppkOh+h8mj5aENaIREaKFcIUTcvnAIjZ8 hCpm/7u5VI76cwqCf8kbZjM4gk0knb+aGqYCcTyvPTJM6yIjhWWWjdVkKjwEXMNwJBz8 0IgTdGd1opASadJxYsmhl6dDTgZwvZkNpJpdY0m2Z3g9V7wx0NuAk9wNuIVOV+/tfoKK XhUnqaOuB5JRBSf3/WN2WaJc3OUCwASCiz2CqsMaR3MPa3PajN3XjdkWGkyJ4AQ0fXjd +NBfAGjJUz/0Nagq/bNjz69AFfoc5QcgFuO+00pVDOsWB5BRpP9AhejsehqB2KJ1NS+p JGyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3BFwltcKlarcNHsBQ5fgE4su5DLlDyOnN0mFp9s/OfE=; b=U38SsiRVhSSaqdCtDr3pzlgOOyF0+lbg+y9plxe+0Vx/NruwxdXu7CHACgLyAk9gSt Io7cBISKpEEP1IfQUPMvNnMcSeSQKmKv+rU9q5JJsaXc74C8FdERcFqR5/LQ2BxnDv7w 2dTpucxRocFbOEyJUKezGPvsPhze5dGLPlr0QafOESW2Ip1AeiOKZvn0jFZ70CW84qdx w+jpUrrkqB15RcP5fHcR/Y4bKmfTKiZAyyyEeCbDHuZeISiS6RmGnHSUrgMTOUv8cnkC eoTdxvrCBGjHTmpoC7QW4Y1iMEFmr+yROlynxXy3JPleWKbKdRDdh0vTgn+/6IZhCIkK oA/w== X-Gm-Message-State: AOAM531GyeFNinZKHbxth1Qf+VZHdq+CFG2TWjUrNp1YSqIVu8O8UOs6 +wTXmA5bJAtnx3wk00cUkrC8qGfSq4o= X-Received: by 2002:a17:902:ac90:b029:da:fd0c:53ba with SMTP id h16-20020a170902ac90b02900dafd0c53bamr4882275plr.23.1608307816773; Fri, 18 Dec 2020 08:10:16 -0800 (PST) Received: from localhost ([47.251.4.198]) by smtp.gmail.com with ESMTPSA id m26sm9622047pfo.123.2020.12.18.08.10.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Dec 2020 08:10:16 -0800 (PST) From: Lai Jiangshan To: linux-kernel@vger.kernel.org Cc: Valentin Schneider , Peter Zijlstra , Qian Cai , Vincent Donnefort , Lai Jiangshan , Tejun Heo , Lai Jiangshan Subject: [PATCH -tip V2 08/10] workqueue: reorganize workqueue_online_cpu() Date: Sat, 19 Dec 2020 01:09:17 +0800 Message-Id: <20201218170919.2950-9-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20201218170919.2950-1-jiangshanlai@gmail.com> References: <20201218170919.2950-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lai Jiangshan Just move around the code, no functionality changed. It prepares for later patch protecting wq_online_cpumask in wq_pool_attach_mutex. Acked-by: Tejun Heo Signed-off-by: Lai Jiangshan --- kernel/workqueue.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c2b66679c0aa..dc891b5c0868 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5087,12 +5087,17 @@ int workqueue_online_cpu(unsigned int cpu) mutex_lock(&wq_pool_mutex); cpumask_set_cpu(cpu, wq_online_cpumask); + for_each_cpu_worker_pool(pool, cpu) { + mutex_lock(&wq_pool_attach_mutex); + rebind_workers(pool); + mutex_unlock(&wq_pool_attach_mutex); + } + + /* update CPU affinity of workers of unbound pools */ for_each_pool(pool, pi) { mutex_lock(&wq_pool_attach_mutex); - if (pool->cpu == cpu) - rebind_workers(pool); - else if (pool->cpu < 0) + if (pool->cpu < 0) update_unbound_workers_cpumask(pool, cpu); mutex_unlock(&wq_pool_attach_mutex); -- 2.19.1.6.gb485710b