From patchwork Fri Jan 13 17:40:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Schneider X-Patchwork-Id: 43510 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp403243wrt; Fri, 13 Jan 2023 09:52:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXs1b7r0U33QjYEsnC1boKvPHCjrAcbEdCd0ybj64cOTuR92MwduSDRbTCy7PuF2wdMiHAEr X-Received: by 2002:a17:907:8b8a:b0:82e:a57b:cc9b with SMTP id tb10-20020a1709078b8a00b0082ea57bcc9bmr4507128ejc.24.1673632346218; Fri, 13 Jan 2023 09:52:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673632346; cv=none; d=google.com; s=arc-20160816; b=MHWPiyEpSXRe6WbPGq7sd99adQK/Sra1nYvUWP+KPMdhsvLyVUJlgDIzxhGJmqB684 YUA996F0MRTmJrDi82TmPtbRqg9zK3NF6XNdf9gVnpIjDc4r4A9T/2bCFcZJbQyTza9b y6oLxc2Ry+XVmBMa+aat8NJ/E4k8fQZOSMii2REKF264BqdoieBoUKmskhOKgBc79srA LnSCwU1k3FdTsA/EvtKQ5TqB+5xqr5nPI8AQA2SNubJVokjkuTPQCKsgs8W2IejQJX2b 6KjHFemjp4+VSpyPQzVOVEfbCoRicFgXjswgtj5hjFKgqSpHMdSUEHe30NhpcY00gZSc +Wuw== 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=XeXOBiBQec1eYZ+PYC3J6nXlnuLgGSoZaVRzf4a0Yn8=; b=0/nty/P7peNgur6/2AwYNrKc2yBWXdHGah7+CC+Q46gGhaJMzz6Hf55JmoQkpooLtc XfagDsLlhi8UQnklkGmUZUXUgrkTDLQCaOQzJrvRwEfeUCS7iUh9mLppnvqzHXJCW/Ok zIEi4FlgKZZVhTHEr7sSDUieXmgaX83O/ErS8upIg4B1nK/O+gAyJMKEx6WPIuSr8SxX oUPbHDIHJ2A1e90XSk2TSyRn7pqtcIgwFc/cPTt3t+MimrD2frb32AmGtKuvC/QR/F/z 4kh7xwDQovUA+1oyHSIaS0Cw1cMmUdI6a/jz3iMfebJfOH61IV3QI5fUeDIyjnAqnca0 2FVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="AVgbcME/"; 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=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o9-20020a170906974900b007c128ebacfcsi21117816ejy.835.2023.01.13.09.52.02; Fri, 13 Jan 2023 09:52:26 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b="AVgbcME/"; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229497AbjAMRuh (ORCPT + 99 others); Fri, 13 Jan 2023 12:50:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230040AbjAMRtn (ORCPT ); Fri, 13 Jan 2023 12:49:43 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8543B848C1 for ; Fri, 13 Jan 2023 09:41:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673631659; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=XeXOBiBQec1eYZ+PYC3J6nXlnuLgGSoZaVRzf4a0Yn8=; b=AVgbcME/4Ri1Eh635IyIg1ORNbTfzm/SNIsFdAi28aZXY1M5iUlMiGYTpyVzbJOQmXWRoI bXZggAtvWv7+vjav5sQOzSKONvXgdOSD/2ptHPztEtlxvQ3Iazqt471sR1XItl8ILOV1sR qIwp2KtRGpXQzUknlVDchinu5pv0yy0= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-611-fa4jNFgDOyyH-awXOH9YEg-1; Fri, 13 Jan 2023 12:40:56 -0500 X-MC-Unique: fa4jNFgDOyyH-awXOH9YEg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8FD2A281723D; Fri, 13 Jan 2023 17:40:55 +0000 (UTC) Received: from vschneid.remote.csb (unknown [10.33.36.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 71BE64085720; Fri, 13 Jan 2023 17:40:54 +0000 (UTC) From: Valentin Schneider To: Linux Kernel Mailing List , Linux Next Mailing List Cc: Stephen Rothwell , Tejun Heo , Lai Jiangshan Subject: [PATCH] workqueue: Fold rebind_worker() within rebind_workers() Date: Fri, 13 Jan 2023 17:40:40 +0000 Message-Id: <20230113174040.1344293-1-vschneid@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754930711186143814?= X-GMAIL-MSGID: =?utf-8?q?1754930711186143814?= !CONFIG_SMP builds complain about rebind_worker() being unused. Its only user, rebind_workers() is indeed only defined for CONFIG_SMP, so just fold the two lines back up there. Link: http://lore.kernel.org/r/20230113143102.2e94d74f@canb.auug.org.au Reported-by: Stephen Rothwell Signed-off-by: Valentin Schneider --- kernel/workqueue.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 0d44c33b5b24e..dce29154cd07a 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -1986,12 +1986,6 @@ static void unbind_worker(struct worker *worker) WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, cpu_possible_mask) < 0); } -static void rebind_worker(struct worker *worker, struct worker_pool *pool) -{ - kthread_set_per_cpu(worker->task, pool->cpu); - WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask) < 0); -} - static void wake_dying_workers(struct list_head *cull_list) { struct worker *worker, *tmp; @@ -5149,8 +5143,11 @@ static void rebind_workers(struct worker_pool *pool) * of all workers first and then clear UNBOUND. As we're called * from CPU_ONLINE, the following shouldn't fail. */ - for_each_pool_worker(worker, pool) - rebind_worker(worker, pool); + for_each_pool_worker(worker, pool) { + kthread_set_per_cpu(worker->task, pool->cpu); + WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, + pool->attrs->cpumask) < 0); + } raw_spin_lock_irq(&pool->lock);