Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2659717rdb; Mon, 5 Feb 2024 13:29:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHsi8LMyWNmVt4N4fjwsB3LXzKvn04lTGOZnOl6cYPGDG3OGFQJG02xKHRPX5nnifBe2wpU X-Received: by 2002:ac8:5f95:0:b0:42c:28e6:1e92 with SMTP id j21-20020ac85f95000000b0042c28e61e92mr858674qta.4.1707168587751; Mon, 05 Feb 2024 13:29:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707168587; cv=pass; d=google.com; s=arc-20160816; b=vLC7SEAyKRWyicFSnQa+HvceIdZAogWbrNbupbVGDzifvfW1nYN4DtCn2PrMuvIqHQ HltHcfzdtaQWRN/cZr7e+lgRXI6wHfFxdlnPoIIx5b++xyR4y4ui276NuBRrR3D2i/6C TJCF8XWlXpVXr3Al/mhg6maDoylei0IsNkmLdNj4ne+a66AKFkC7PyUrpC/Yb4PmsBV8 2yEjJHHpTaLkV5gM4Qbqc9eLwMopPiPTxT/8oxZPr31lmQflZ+viJB9AtmNIDoiqp64q f72C8oCbMeWXi2QYfTFXGoTrw56pN6DLbyyuwYR/2lygk6vbWqY3gFnUY8A8P1pSdvk3 RRWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=rbQHwYA7ykmolC0A4lTROkm5bxARusbIFHiZqSIfIjU=; fh=A8D2oEyAd4hC5x/77GoYW1/yQuEe1Ifnn1T44l+ELbE=; b=EIoFWTRea7wMfzErbBeqbPIiAvDTTsBckwfzvKngTCXcLLb2t1APrquLUpymIaGUeo MHVv/DtFZjuHSXi22X2CZqpzb9Yz9PXYfVaPC+DbqUPD11H2HHNAFaZkqA++UlKi+naI K8a2bH9AsA4EK75PP+ulyu11L+oaX4+hk7RYtxiM+wcbeieWQcix0ikP62JQLOZvZsk6 z9526C9Qq1EbXUwI1SN+3hcif+HN+1z9aL2eOIppf8k/vExIQhonMK5KmG4uWLgLmkb6 y9/B3dCI8gOSZzGP5H9v0BCw8mr6XFKZIIXo8BTZyw7S4aMni/sEmlIxHYtlf1jBhuQx uQVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NA0p9ykt; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-53858-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53858-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCUQlSXyldfaI6q3QykxS1Vc8BWpF73yKnJSqx0rBKzNypuK13Fndq99qZpQelR4U9y9apshG6VTqxs3DdhQSW9mlOH74+4X4hWbGSgp+w== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h17-20020ac85e11000000b0042c00c202a5si776359qtx.532.2024.02.05.13.29.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 13:29:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53858-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NA0p9ykt; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-53858-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53858-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7E36B1C26E16 for ; Mon, 5 Feb 2024 21:29:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 045487E799; Mon, 5 Feb 2024 19:46:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NA0p9ykt" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8CBD57E57D for ; Mon, 5 Feb 2024 19:46:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707162402; cv=none; b=TBxKrwp2UOVOd4bzRs0MydtjHYzvpp2oO9dZN66ewSb14u6Th15qENwET5whd+fgteyjTuTsHzo9i9P+hmwi/k8AgW3XJaGORWRZeUVDF5POoHz2h6D8H3jypTc+g03rpwgfrxJrHCEAbx+rCaMEyhZAv7hXTY6v9OT4IejFgoY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707162402; c=relaxed/simple; bh=vO8HGkvtn6jz0wtvFkjiJ9lBXoPwD9WE/SfztzX7xQA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=p1mVovRGlARd1WtqrrrGxgHZ6uXydrE56qQRea0pMtqbky/4h6nQWqPC78O3hZzMvmYvL9gVfjqSJXBjb6SObYNxfxMyFQxRArUsNCOW6QwQZdeZ3V6lvmFtE5ER09edKmNWJ3M195DdVOPX/HIRDOpzTZsgf4hl5v8DlDL4rYQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NA0p9ykt; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707162399; 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: in-reply-to:in-reply-to:references:references; bh=rbQHwYA7ykmolC0A4lTROkm5bxARusbIFHiZqSIfIjU=; b=NA0p9yktrk3mGQv45D1kuRcPMLTYOIsjsUEdC6f5b+QOBxUvP2F9AMt3PNfDlr1cp5iKpS 3ULSwxi3rexljLd+/0No7RNduN+L6RE1SlYXe6QsY6OmJFY4n6Pz5wkDuNpFJDJuB8Gnb4 j1I4FZlf5jdQ0g4dkUUO0PQ4XZRTE0I= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-5-kVMk7NwuMUSN5LxNo7eC6w-1; Mon, 05 Feb 2024 14:46:37 -0500 X-MC-Unique: kVMk7NwuMUSN5LxNo7eC6w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8EF9785A597; Mon, 5 Feb 2024 19:46:37 +0000 (UTC) Received: from llong.com (unknown [10.22.17.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19E3E1C060B3; Mon, 5 Feb 2024 19:46:37 +0000 (UTC) From: Waiman Long To: Tejun Heo , Lai Jiangshan Cc: linux-kernel@vger.kernel.org, Juri Lelli , Cestmir Kalina , Alex Gladkov , Phil Auld , Costa Shulyupin , Waiman Long Subject: [PATCH-wq v3 4/4] workqueue: Bind unbound workqueue rescuer to wq_unbound_cpumask Date: Mon, 5 Feb 2024 14:46:02 -0500 Message-Id: <20240205194602.871505-5-longman@redhat.com> In-Reply-To: <20240205194602.871505-1-longman@redhat.com> References: <20240205194602.871505-1-longman@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 Commit 85f0ab43f9de ("kernel/workqueue: Bind rescuer to unbound cpumask for WQ_UNBOUND") modified init_rescuer() to bind rescuer of an unbound workqueue to the cpumask in wq->unbound_attrs. However unbound_attrs->cpumask's of all workqueues are initialized to cpu_possible_mask and will only be changed if it has the WQ_SYSFS flag to expose a cpumask sysfs file to be written by users. So this patch doesn't achieve what it is intended to do. If an unbound workqueue is created after wq_unbound_cpumask is modified and there is no more unbound cpumask update after that, the unbound rescuer will be bound to all CPUs unless the workqueue is created with the WQ_SYSFS flag and an user explicitly modified its cpumask sysfs file. Fix this problem by binding directly to wq_unbound_cpumask in init_rescuer(). Fixes: 85f0ab43f9de ("kernel/workqueue: Bind rescuer to unbound cpumask for WQ_UNBOUND") Signed-off-by: Waiman Long Tested-by: Juri Lelli --- kernel/workqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index bbd4269d2729..6077d5d663c3 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5300,7 +5300,7 @@ static int init_rescuer(struct workqueue_struct *wq) wq->rescuer = rescuer; if (wq->flags & WQ_UNBOUND) - kthread_bind_mask(rescuer->task, wq->unbound_attrs->cpumask); + kthread_bind_mask(rescuer->task, wq_unbound_cpumask); else kthread_bind_mask(rescuer->task, cpu_possible_mask); wake_up_process(rescuer->task); -- 2.39.3