From patchwork Mon Feb 5 19:46:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Waiman Long X-Patchwork-Id: 197034 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1158693dyb; Mon, 5 Feb 2024 13:36:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGHx7SSChMoUkyQtGyIrSMEnvyH9CA6488xxkIkhwVYQUuNCbcUGLEtNmVJGGXAWbCFd+bu X-Received: by 2002:a17:90b:2282:b0:296:a43f:66f4 with SMTP id kx2-20020a17090b228200b00296a43f66f4mr694155pjb.39.1707169009148; Mon, 05 Feb 2024 13:36:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707169009; cv=pass; d=google.com; s=arc-20160816; b=U7o8Ls/lJEQzZqnWFcfQCkBg11VpvYFEYMYAN20Vc2D2CrxDtPDQfpvfwuVRObDCmS 7lPRP3x2FDeW/ZKWZGJaFMW7NJZebPvWx/I6FRcN2oeIlVyhv6doeFmpS2jlcQ5tIA1L v+hlWt29UlrRamr1GkoIbE6WsJPrP4HTXTPGmMwUusVoij8A1ttGuOI/tga7R7Tn2McN O4WjPeY8pfNx/kqGPRiETd6MYqYyjhdP+4d8klP35Du9vJ82px+xqp6BOeZWsjtbEIRo 3zksmR/QerPyqelnp6HN+O5vMNyYnqLKNtjc0HkEm4BMqDy9IeibJaTKr4n/A9K6iO/j 6KVw== 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=VF96lC8fYFOEfIkZBjvseaWN5aR5XDz3GB4KkMgAJ54=; b=nSYoji9qicr7RgnXkkyv8umJCgmKEXjBiDuDKFza9rgTd1bWMTnRjztBVtrvU+MjtN 9WShJTP1c6z0u1DsXbHYvodVuo63W47vlLv/jNqCJNTsgAF/615V8dxM9xOSHkb0V8fP pUQYWGrzlXRQVrk9VLrkOrJyObKMsxLrDQkzLXLJH2PgGLftn5K5uwWfzSHYkij1Dsm9 wrix9lJpeKPxGMhI/ejYZJlRDYIYWyFJPWyPVIhp9zz8ngN4CigF+7LKEMCtsvgKImzt VXeh0UiJwb9+dkdTWjHs/gdHyDrbtdgZk2Q7HCMMdFw1hTUjhclUrfFblCPAO5HnHTPO BNag==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53858-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCWFcDpIXWeN07hBCAArQ422Wu0a3C1VWnIZ0ashA2+qe9HQHWkQPbmSXs9Yhdua2Bde8S15PFEeXp60viq45ZNBiF9PFg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s15-20020a17090ad48f00b00290bb3c8792si519093pju.124.2024.02.05.13.36.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 13:36:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53858-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53858-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 653B1289176 for ; Mon, 5 Feb 2024 21:30:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D6A047F7EC; Mon, 5 Feb 2024 19:46:44 +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 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790096450492868235 X-GMAIL-MSGID: 1790096450492868235 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);