Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp428721rdb; Thu, 8 Feb 2024 09:46:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/L8w91EVWfmAiYlKwdAZW1NF5Mrer/FSWCwpBxuK/IbfrXYRJ+D+w2s8tgFNVR2HrmHwQ X-Received: by 2002:a05:6a20:1453:b0:19c:935c:ed27 with SMTP id a19-20020a056a20145300b0019c935ced27mr395300pzi.21.1707414398784; Thu, 08 Feb 2024 09:46:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707414398; cv=pass; d=google.com; s=arc-20160816; b=xM2wHoqywYC0c0slryTvp0OWFoD2UXGrO4KUDLO8HW00yLN+ptPiErvPVfPWUEx9bW nAFxgsjW/RqR4dARYlzcESmH+OBz9BJ10QgLZiuXzO0U4b/nBwhnWNyY8N+AYirSX74F S4zfB3DoYVq86WlRcrTIwGACTirq51xkPmKeDYGPMGso9z9v789dOl8cO9JDjCSu8SbE ilPA5ur8HKY/lfZxNsJPEw5K5wfZ2eJ/m9NwI9hXXuc3yA9PzNTbD99TbLz4rbCy7WPH L+qDJ4I8j75gFjBi4VsY0W+Z9b+Yey50qwgB/mJWYHc1ZlgK+5W+lQ4ZkWqA/OWNTN3M yVtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=kbA8ylbFRlKyg5U453MmfWxg4qPQ1odWQVw3a/yjMMA=; fh=XRwJhCoGgZgPn2nFZ0i98FtnM+spk1PD+j8EdED4T+M=; b=W+Ak7XWXvqg4kTaYmeu3M3WELkFhrdU2r0KHGvwwLpY7qsAM+suJpWkdb8ggbGSEOQ Q2inMir9xHZdDDeGVVLQD+96O4sx/0Bp710gBoemFjxY6xBhHwIpJfQUCbIJyhg7fJKr KSw9TUgWk94DospIB0oJJo0bQOt6WNQNaeq4Uw8W46Fws9c0fHaLeeLTkocU0x1NiiJ6 nEShACKz+4GfY1ymH5dRj5LoqVk90QlCEe6f0ppSfRxjgyxWcSH5jfpTxhkIaFCyW/I0 irvMYwHoJLlaLY5zR4yfqAMJ0LHvagvSBAmkpDcGIUbaru8o9nXPk5iqBSqx8W8fxwMh BzWA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hTYvaocI; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-58475-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58475-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUc7Op0ZwcI2PruXyjsawXLty/sgZAO2V+mDIgdeGE56HWEsl6aslrKqiqv8esxBj6KCnymVIkk7RUXVmxb0ufg1A6HJoM+udbqaTRO9g== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id w6-20020aa78586000000b006e07d6e2d8bsi4753pfn.122.2024.02.08.09.46.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 09:46:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58475-linux.lists.archive=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=@gmail.com header.s=20230601 header.b=hTYvaocI; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-58475-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58475-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 99DF9290FBC for ; Thu, 8 Feb 2024 17:42:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F902823D3; Thu, 8 Feb 2024 17:42:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hTYvaocI" Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBB34823C2 for ; Thu, 8 Feb 2024 17:42:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707414151; cv=none; b=ObNX3zU3duxsdCGyFNq0pRlXOphH3CZHmocgbBN6FcJsFUNxeVyMPgr6GXLwVMryXJjwjcRUMMpSLmEZ9uJ6XdhhG+wqYKQuTgb5DJhQzoIg1pxBAXm1lUjvBkOt6t/fGfYIHW2RQzRZr40amAhNTHARxLq0iy013tdI4SxHJjY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707414151; c=relaxed/simple; bh=r3ot4oF1LX3nA6eTOhVf+jyF+CVFFa7172oMKsIh+b4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ih1Uxj2C7358to0hVFD2BJEAcn9rV0bV4wRpJy1pxMlRPuMvzB4eJQFyvSiHsoJe3smLLhA/mDPmjQ93NKYToMUUAPU/8d7f85YhcghbaeHRkh37CRZVEV+ftRuBGzFsU9yJZe81r69Zq8sYPuyGFp9hIbS9Fun7KiD10XWQ76U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hTYvaocI; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1d944e8f367so339385ad.0 for ; Thu, 08 Feb 2024 09:42:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707414149; x=1708018949; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=kbA8ylbFRlKyg5U453MmfWxg4qPQ1odWQVw3a/yjMMA=; b=hTYvaocIehF1NJeE88McVIzur5iFgb2oJkcoUJv7bWzCGSgK77SJWluiqUgwBgXTqb Y8unvikmGPK8RjBTj9/gBWptfUMApx030JNmaC63qU/VksrsLrY1+I0pwXdtYnOQOPSu NlC9P/F4Oy80Z1MwjTBjt8Iu/GEht6mPm7RBEj966of7Wi/QU1Cq1Ovw+Ym4z3p44D5x eQp+B/9cZy1ZtBOTWHuu97/h86LOYNC2zzNoHeoUdKcOV5O/TMhlgBXekDbPnD3AZEdS quGV+j4foPNS/gLh0KD/Tl9SoOEcTMBjvdsgmLCYnRcGJKMeWs9re906NOrCxQcZJYHP /TMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707414149; x=1708018949; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kbA8ylbFRlKyg5U453MmfWxg4qPQ1odWQVw3a/yjMMA=; b=adhJ4u+rrRDcF/irbY/DvVg/VuzZGyQRWDZ0sIlnF1Cc2uACPiASromse1n5ZqPS2O MALHp2KH4tvmTchbGL/xal/4vj1koyhd1vuHSdteLTSDmcaHXGnHFNGG5YZkqMVfeIec 9ujnIpiipUb0/JlGtm5agU0Tqj3YLEe22xuQH+s+Ctk6LTiUE/x5gcBpteNpLIUNFsXT +tI5vq8KFburqOjHRFVnwXGQtMHBmLfLTQCNOQTCuuSooxM4v7oDhyz2IY/xK/sLzvFM ivBcvlYECb8MYdDV8NAigWN5DiK48BF9J3mJ22/RyyvfSAbmv5Sybsyj3S5bL4SNXBnP /+0g== X-Gm-Message-State: AOJu0YwudnhDee/fEntCOQAv5SOzMgAh/TVc+3AzMVkVPyXZl2P3ap8s 3ERvjpTuFRxMjQVH6EEp9X2n6Fm7dq9UsOcs+UqgthslURi+msng X-Received: by 2002:a17:902:e548:b0:1d8:fafa:f923 with SMTP id n8-20020a170902e54800b001d8fafaf923mr10701826plf.10.1707414149142; Thu, 08 Feb 2024 09:42:29 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUuLQdpMvgMSpEolg7dRZzQIMALmahYAibXzcxpqNiziqewujlGdkHkym2hAvMMGY12mwW2XKyEI6yKivy7gXcvR4pMRzr8XGLB2mXBa1nYCHldWUX7LdBN/+/wZP7kBHiAXG8A7+Elrkn7ezrDZK0gzging/43et5msVEXE9xfCdR45gSRc9pL3RONG7dF6qQlnEuQsruPByqcT1a4DiPBD+nw9J4fPAP7uVeEP3I5AyULM+s/Q3lfDctjgV9RuBF/ycxQIw== Received: from localhost ([2620:10d:c090:400::4:3c45]) by smtp.gmail.com with ESMTPSA id mn7-20020a1709030a4700b001d8aa88f59esm15975plb.110.2024.02.08.09.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 09:42:28 -0800 (PST) Sender: Tejun Heo Date: Thu, 8 Feb 2024 07:42:27 -1000 From: Tejun Heo To: Waiman Long Cc: Lai Jiangshan , linux-kernel@vger.kernel.org, Juri Lelli , Cestmir Kalina , Alex Gladkov , Phil Auld , Costa Shulyupin Subject: Re: [PATCH wq/for-6.9 v5 2/4] workqueue: Enable unbound cpumask update on ordered workqueues Message-ID: References: <20240208161014.1084943-1-longman@redhat.com> <20240208161014.1084943-3-longman@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240208161014.1084943-3-longman@redhat.com> Hello, Generally looks good to me. Minor nits below: On Thu, Feb 08, 2024 at 11:10:12AM -0500, Waiman Long wrote: > +static void unplug_oldest_pwq(struct workqueue_struct *wq) > +{ > + struct pool_workqueue *pwq; > + unsigned long flags; > + > + lockdep_assert_held(&wq->mutex); > + > + pwq = list_first_entry_or_null(&wq->pwqs, struct pool_workqueue, > + pwqs_node); > + if (WARN_ON_ONCE(!pwq)) > + return; > + raw_spin_lock_irqsave(&pwq->pool->lock, flags); Can we do raw_spin_lock_irq() instead? > @@ -4740,6 +4784,13 @@ static void pwq_release_workfn(struct kthread_work *work) > mutex_lock(&wq->mutex); > list_del_rcu(&pwq->pwqs_node); > is_last = list_empty(&wq->pwqs); > + > + /* > + * For ordered workqueue with a plugged dfl_pwq, restart it now. > + */ > + if (!is_last && (wq->flags & __WQ_ORDERED)) > + unplug_oldest_pwq(wq); I'm not so sure about is_last test here. unplug_oldest_pwq() is testing for NULL anyway, so maybe just drop this test here and drop WARN_ON_ONCE() there? > @@ -4966,6 +5017,15 @@ apply_wqattrs_prepare(struct workqueue_struct *wq, > cpumask_copy(new_attrs->__pod_cpumask, new_attrs->cpumask); > ctx->attrs = new_attrs; > > + /* > + * For initialized ordered workqueues, there is only one pwq (dfl_pwq). > + * Set the plugged flag of ctx->dfl_pwq to suspend execution of newly > + * queued work items until execution of older work items in the old > + * pwq's have completed. > + */ > + if (!list_empty(&wq->pwqs) && (wq->flags & __WQ_ORDERED)) > + ctx->dfl_pwq->plugged = true; Can we test __WQ_ORDERED first? Thanks. -- tejun