From patchwork Mon Feb 5 19:45:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Waiman Long X-Patchwork-Id: 19958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1158700dyb; Mon, 5 Feb 2024 13:36:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3zB2xF8RUiWtQM03HgrnGTsWY8m7alaZ3/IxuNwUzjCBKPQAztzAc5z9yAZ7pwyk3QicD X-Received: by 2002:a17:90a:e409:b0:296:321e:99ef with SMTP id hv9-20020a17090ae40900b00296321e99efmr798815pjb.17.1707169011008; Mon, 05 Feb 2024 13:36:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707169010; cv=pass; d=google.com; s=arc-20160816; b=V81kU6Ho8pTSWGJJQLwzxxFdzQazmNYZfcS1VlVgOGHBykA0QK6rp3yldKeFuL/Q0S 3X/WX0vFvwZOLEYMiLIUUFv/xWr24twezdYUGOmWBYw27JwZ0sv+DW9G3xjjPInzFRn+ STcQUEZsT5FzYMeTDMNnL1BnAmFxjdJ5PYgXkyDVFk/gDuL4jA4V8tIPK6SGuPtcBX85 IjVmcad+tHyl0LL7Ax0PnICvZ4OEbtSjjah8aBHslShmRNpnIuikZwM1i4HrWwZbGV7v zM7vrVKvOVIAT4RjBkXorr5lgA2HJtnKcTDS4ZBWzVbhyocWEuYsWHEWpoxYhf1PeqPU pmAA== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=2wAq9zuBQRCHAAv9+2rXsge637bX5qI7IyvgEpLY8sU=; fh=7BlHWJGrHPhdcrzZEzY+unil4PKryWjPYMctdm3hV7c=; b=bEAEWdretsxtNXdU/PZO9gUOsnHQApg2k1SvDfiCeqgIDB0x9qgoNhuoqHj1IvVgqy 0OPgzBmRPWR28uClunqxlXvX/7eC52Z5UfN9vYJ69XrCwpVWSLn/rQG0Qi4PakpStK8j JX/XJMZ5CXUYGug9yOHakH9xXr80ApXbHbJgPOcSB8fRzXgz0rLZr41RwaYuUKeVFQSV 4c361Gasv8gvqH0cOYBtWtO0Z4yKWI6aaiEuGJElxE9zlIbqzfMAha3wq5IMsW1b9dpC lnQOuZVqoIWDd1EKJTxc6SXEVQErCd7RkF+sjwR20jWqq0VE4tyR605FsLAtd3WQAz06 h6WQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RjhfQK0N; 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-53860-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53860-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCVNlZeKxSE6ivQF65+On3rH2rJUBT1cpGytetTVee+buoYqUnQACKSBmJV6zMvfBiPCwJQxhZSKtIS3cEi9QK+dtn/M2Q== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id my11-20020a17090b4c8b00b00296c3b330edsi282110pjb.170.2024.02.05.13.36.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 13:36:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53860-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=RjhfQK0N; 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-53860-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53860-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 B94D1289480 for ; Mon, 5 Feb 2024 21:30:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B7097F7F2; Mon, 5 Feb 2024 19:46:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RjhfQK0N" 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 D825E7E585 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=KnHPXdsHxwQOVzUqo4DRC8zsGDEv45utvV10ePP5LEQ1sBswFKEfO2Bo1Xq4BupfhieZOMTq/GPKgbKlg8Z95+Kpu7mIyQf7ub8YaWpJ0TAa+sguVk7wjvspk0tZIYmt7xedsWdeBZj4yr+HXiKsjOcHNP3CON1p7udl8tF15l4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707162402; c=relaxed/simple; bh=a/l7dIHL4lD27xI3QHJBmm7xg9IPaYq194T/QUkU0vk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=RsDyGTd2wjOOcGKki5YZAT+fpAuo+fXXb10G6+B/zEAb1lUM1AKCnzfuv1IJKbAVrZCJa7DNKUUdyU+JTQok6SupiGwPvSK98NYkOwCZIJ/Q+GW/KkRz96kWRR+DyAoIr9Fgc66hBgo9D4AmSiCrKw0KVfIlwflgEAiz0YcJuuQ= 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=RjhfQK0N; 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; bh=2wAq9zuBQRCHAAv9+2rXsge637bX5qI7IyvgEpLY8sU=; b=RjhfQK0NrmjjFaeBH1FqtiqoDqW4LUi0IlUeFBvMcIi34fR7KV8d9FVpZN7UafR2zmj1tH QyQGxbjPNG+izPzoT0l2pVgsRAnODK2HUBhUbxDP8InrSgwD44pD2ZoN6RX0l7i0tIKCgV cHL6laUhlE4TisGNqjL2x7BjgXH4rAc= 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-621-iAC3FgjmOWyn7ePocsI6QA-1; Mon, 05 Feb 2024 14:46:35 -0500 X-MC-Unique: iAC3FgjmOWyn7ePocsI6QA-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 61863800074; Mon, 5 Feb 2024 19:46:35 +0000 (UTC) Received: from llong.com (unknown [10.22.17.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0DA11C060AF; Mon, 5 Feb 2024 19:46:34 +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 0/4] workqueue: Enable unbound cpumask update on ordered workqueues Date: Mon, 5 Feb 2024 14:45:58 -0500 Message-Id: <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: 1790096059466861068 X-GMAIL-MSGID: 1790096452560746334 v3: - [v2] https://lore.kernel.org/lkml/20240203154334.791910-1-longman@redhat.com/ - Drop patch 1 as it has been merged into the for-6.9 branch. - Use rcu_access_pointer() to access wq->dfl_pwq. - Use RCU protection instead of acquiring wq->mutex in apply_wqattrs_cleanup(). v2: - [v1] https://lore.kernel.org/all/20240130183336.511948-1-longman@redhat.com/ - Rebased on top of wq's for-v6.9 branch. - Use the new pwq_tryinc_nr_active() mechanism to freeze the new pwq of an ordered workqueue until the old pwq has been properly drained to maintain ordering. - Make rescuer follow changes in workqueue unbound cpumask as well as its sysfs cpumask, if available. Ordered workqueues does not currently follow changes made to the global unbound cpumask because per-pool workqueue changes may break the ordering guarantee. IOW, a work function in an ordered workqueue may run on a cpuset isolated CPU. This series enables ordered workqueues to follow changes made to the global unbound cpumask by temporaily freeze the newly allocated pool_workqueue by using the new frozen flag to freeze execution of newly queued work items until the old pwq has been properly flushed. The cpumask of the rescuer task of each workqueue is also made to follow changes in workqueue unbound cpumask as well as its sysfs cpumask, if available. Juri Lelli (1): kernel/workqueue: Let rescuers follow unbound wq cpumask changes Waiman Long (3): workqueue: Enable unbound cpumask update on ordered workqueues workqueue: Thaw frozen pwq in workqueue_apply_unbound_cpumask() workqueue: Bind unbound workqueue rescuer to wq_unbound_cpumask kernel/workqueue.c | 127 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 113 insertions(+), 14 deletions(-)