From patchwork Thu Feb 8 16:10:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Waiman Long X-Patchwork-Id: 20118 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp277246dyd; Thu, 8 Feb 2024 08:12:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVjXPlNNIu4FWAAwBcZONmxEtIlOEtVafqWwvXMPIOuEAEPYFzCSDZKhyq4qHDLDlirdl3piaTiQKbk9rsersocL6uc4A== X-Google-Smtp-Source: AGHT+IFhivVyX1YfyCBOG0v6PoaHbxqNG0uxgZHkFgchTyR5PNaBb2PTgi+j5ZIpdqllc945Nv41 X-Received: by 2002:a05:6359:4c28:b0:178:7986:a586 with SMTP id kj40-20020a0563594c2800b001787986a586mr6941681rwc.5.1707408751438; Thu, 08 Feb 2024 08:12:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707408751; cv=pass; d=google.com; s=arc-20160816; b=Nk0NdEOynD7gCU9tqkvlMar9Ays2/OW6JLbflwnKFaYKRxUDr51IdTPRLgg+FBNUDS WXDqFxfTFhaT2URH0NL9d6bkSIElS+c0gHBz3FAd/BikFVV8oW91joGNA7TRO9Z/bU8K D0wudyXqP5I70wHd6TxjKOsDP8Z5kiNBicQoN3UUuoapucREB5Xw4dqN7PBrtpCfrz2n fQK8JvgfIfGPifwDTC1bMpQ287aFO43bDCnihJT4OK+5K9FIs8Fn7k9HWNpHo2EqCg2W h0GnfP+WOaX2qhsJa8XewpD9scXwuiA3KYmHymDAYLOwldn6gYoI6oWmaaBZOPYULCYw VLxg== 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=PUWu16mgbWaE5xtucdhmWtcovtMptwL5XmanWGj+1j0=; fh=Vvx3TyNtYCqH6YtUPisjBi0AFo5lMD+U/I7v2WUsAUU=; b=w5cMZcLmhxl0K+PrLR60FtKIZeOROyq5NLTNKP3rSCLglOC617jXbY4et8rSQbQdNq 1RtlbVQVyLqyFXqLXoxNove2hRS2FO9Mo8luGq2q9DwprOJxGNdJBMwa3J+Q6aowyJ/H E3DrZRkELcIjdqRD32pa2kwFd1LJ9B9/92SEAHKYBUwaF7UXkX3HdwWL68RzYlTa0wyF HVcoZmf+BUleYBtXz/Gv4R1x2UgDKW+M9+5DoASb0iTAuMfxMwM4LwDV3GVY1Iiv2vOX rjGi18+eXJyfjEEpI7UTYjvnCxeRb2awmJNFbwlKp8u04rS2+WzZqYi+i474oUrodcl9 SEvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Et3upo0o; 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-58327-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58327-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=2; AJvYcCVUAmxgBhkd5SWk1y2GEms0iOJkVrVi9QZjHvM4XOgSanWqA7bSiGTY8rjsZslFtJmnuVWHT5Oa0qZKvojtnAtaQpqdyg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id cn6-20020a056a020a8600b005d8b4e635c8si4756910pgb.849.2024.02.08.08.12.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 08:12:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58327-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Et3upo0o; 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-58327-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58327-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 0321628CAAE for ; Thu, 8 Feb 2024 16:11:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C1B0880052; Thu, 8 Feb 2024 16:10:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Et3upo0o" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 6C3DA7994A for ; Thu, 8 Feb 2024 16:10:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707408633; cv=none; b=UqEolisREf0L9dfJvk9s9Kpa7smRLDisOULyBSX8zNh2uEVEWCy9aOnyfzjLWPdYfHupQCGPkv/ZYNEr6Wf/c7D2NWQxB4sOqMF1G9TKPu0n0IWamHLqF58ptK2lypT1NfaddDGENOJFFwwNHYI1z1THLzqTkgtoZ/IG/CxaAF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707408633; c=relaxed/simple; bh=fp8pgifZfoDofchTOp2aG7ixErXuoj6QPm4g7ry0ED4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ll/rJB7z6w9IAX8nTtCfmy8arF2XaQGXPnle8ki9Tmz8RTfhbeKBBZk+TA9iRl3mOIwqBPeUNPGs8RhlPPL1wzN8147+/xjV3LA8FM4R4rYRWAH2tOiukR1ojvedtltma4XAFWmwjiwc4Yz1J2AdmtpRe0IKxz1eVs/n/zljaTo= 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=Et3upo0o; arc=none smtp.client-ip=170.10.133.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=1707408629; 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=PUWu16mgbWaE5xtucdhmWtcovtMptwL5XmanWGj+1j0=; b=Et3upo0oJDlpJ+h/Lzj4uLHMNUGByeRw6PK8v18j0x9apdwFy++oPSnBynb3gA5XrvwFX3 WyqmXV7cq2sG/ZxwiLuSi6RffHeNzaCgIRid0wXcugfLcn0Lmvl+EmqRHAW7j0YzvkJ1px kQyBl/Y+7Ln9HWC7J2jFLbTt+/pYHQk= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-100-PlygYM99NFuto9qSxggOfg-1; Thu, 08 Feb 2024 11:10:26 -0500 X-MC-Unique: PlygYM99NFuto9qSxggOfg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 6B9E71C0983C; Thu, 8 Feb 2024 16:10:25 +0000 (UTC) Received: from llong.com (unknown [10.22.32.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1AA5492BC6; Thu, 8 Feb 2024 16:10:24 +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/for-6.9 v5 0/4] workqueue: Enable unbound cpumask update on ordered workqueues Date: Thu, 8 Feb 2024 11:10:10 -0500 Message-Id: <20240208161014.1084943-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.9 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790347800737329075 X-GMAIL-MSGID: 1790347838725620839 v5: - [v4] https://lore.kernel.org/lkml/20240207011911.975608-1-longman@redhat.com/ - Streamline patch 2 by simplifying unplug_oldest_pwq() and calling it only in pwq_release_workfn(). v4: - [v3] https://lore.kernel.org/lkml/20240205194602.871505-1-longman@redhat.com/ - Rebase on the latest for-6.9 branch again & discard the use of __WQ_ORDERED_EXPLICIT and resetting of __WQ_ORDERED. - Add a new patch 1 to change the ordering of pwq's in wq->pwqs from oldest to newest. - Change the terminalogy from freeze/thaw to plug/unplug. - Allow more than 2 pwq's in wq->pwqs of ordered workqueue but only the oldest one is unplugged. This eliminates the need to wait for the draining of extra pwq in workqueue_apply_unbound_cpumask(). 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(). 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 suspending (plugging) the execution of work items in the newly allocated pool_workqueue until the old pwq has been properly drained. 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: Link pwq's into wq->pwqs from oldest to newest workqueue: Enable unbound cpumask update on ordered workqueues workqueue: Bind unbound workqueue rescuer to wq_unbound_cpumask kernel/workqueue.c | 81 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+), 12 deletions(-)