Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp660456pxb; Thu, 31 Mar 2022 14:13:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJworgFZVjC/QkuoBnGwGBABeH0hJzveNFB1w2SvTPFszd3+DcHJALJ6/W+behVqKGfxTLM8 X-Received: by 2002:aa7:d904:0:b0:418:d53b:4662 with SMTP id a4-20020aa7d904000000b00418d53b4662mr18493813edr.217.1648761196757; Thu, 31 Mar 2022 14:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648761196; cv=none; d=google.com; s=arc-20160816; b=rLb2VZxFX4Womy4hJMJOqMt4KAPXWvuguQ4KfX8jWeFKsHxfEybG/3xvX6w5Y19ebo udB3cP7Jgn1TTzwTadmhKDcZAsFfq4/s85xQAN7YXeCLUpCzJETh+hX0aMWVJRi26300 BbehJfvu47VHTFcAWqzjuF6/IEXxVxST2lKpTl0fnD2R3wHbEqOv3FdFU44OoaTbZ18/ DK8gL/UxgPDqhj6to3qam86fhiF3dZaQcuDyj84OSjA0R+LVLErm4VhkQYPBXL30dL3W gR7Rk2LAZYritUndZ1E4xKAn7XBnPn12ox2z6GraxJxnud0g68A60XYBlxA/3DYTstRm hwXA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=wrK8Hy66hQPgXQzs1cw7DN+eGhNWGiX3OwiheLrvnJY=; b=HG9ty0NTvCp1qIjIBeZhb5gc9/JGJ7EwplrkP5BNrXcc+ihnXEvuSHkg35bcaxXwy4 foQGPxFU0XeVYUEVegWVahpWU8uhL0D1wpdvDS5j1cKNf5HbeY2rnJNhfAQIlU/aZlSn 46BfcvuolKyG7UF8JtaHYwm4V5Zxlcdkx0rj593MMEsk0ELz3MaHUasu+4rxCw6IWebF OJ8dENKvOb4KstPQDRSjwkDqp1hOXfruuLQiUpWMPiD3hOCbnrzPxfegAKvlkdAKyGak vFvJVYaSFAKVvPzhwYo0285uVWxunm4ZjtKTeoxRJzBS4gVZjp3ZWYp0c0e/sD1h+N3c syiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ETKq//Y5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i16-20020a0564020f1000b004193891627dsi412251eda.499.2022.03.31.14.12.52; Thu, 31 Mar 2022 14:13:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ETKq//Y5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236670AbiCaNPz (ORCPT + 99 others); Thu, 31 Mar 2022 09:15:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236668AbiCaNPw (ORCPT ); Thu, 31 Mar 2022 09:15:52 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59D233EB8C for ; Thu, 31 Mar 2022 06:14:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648732445; x=1680268445; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=O9KnN5FcrCuHH/U+fugRxZJxjGZZZEgGbWJGo5gTUIY=; b=ETKq//Y5SwTZ9sOkDApdu+lwfx1X/wAaW0I6cljUkI0xnPHmGcmDT1ah wowkKmO0hRh+fuibAwNH4Rmc35QyBJ4+j+Dk4LqOwnuUfIZrn2q0d9lRj BuHiO+8eGUHSV3Yob7LZxjxUYidPjUMnM3YFjFJNyAFG4Ri7iMbdcB4dL O7dhsqvpGmTXSlURh1ovmRZlmzvV8PDP0+DptTLb+YS5CBw2qjK26NRVk TPUyZTQEX7UWzmufqa54y8IzIZ4o7GCpgpw5R6qJ6X7QQSJk97KumysFI u8hdlQW6DdgnpP4x+uXP7nANDI35HgINxlAvoFi54HRfShKPsyHLKGbXB Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="258666013" X-IronPort-AV: E=Sophos;i="5.90,225,1643702400"; d="scan'208";a="258666013" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2022 06:14:05 -0700 X-IronPort-AV: E=Sophos;i="5.90,225,1643702400"; d="scan'208";a="547328314" Received: from zq-optiplex-7090.bj.intel.com ([10.238.156.125]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2022 06:14:03 -0700 From: Zqiang To: tj@kernel.org, jiangshanlai@gmail.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH] workqueue: Create kworker only for boot CPU pool prior SMP initialization Date: Thu, 31 Mar 2022 21:14:35 +0800 Message-Id: <20220331131435.2864347-1-qiang1.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The workqueue_init() is called before SMP initialization, which means only the boot CPU is online, just create kworker for boot CPU pool. Signed-off-by: Zqiang --- kernel/workqueue.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index abcc9a2ac319..3948babe02d5 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -6120,11 +6120,9 @@ void __init workqueue_init(void) mutex_unlock(&wq_pool_mutex); /* create the initial workers */ - for_each_online_cpu(cpu) { - for_each_cpu_worker_pool(pool, cpu) { - pool->flags &= ~POOL_DISASSOCIATED; - BUG_ON(!create_worker(pool)); - } + for_each_cpu_worker_pool(pool, smp_processor_id()) { + pool->flags &= ~POOL_DISASSOCIATED; + BUG_ON(!create_worker(pool)); } hash_for_each(unbound_pool_hash, bkt, pool, hash_node) -- 2.25.1