Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3002658rdb; Tue, 26 Dec 2023 12:12:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IGu7Z6f12OLepkI5ZAEzD2vIpIljI1eA6TzJ86xn/0GhN/ayy0krcDTSvqURbG7BuQgcmDl X-Received: by 2002:a05:6214:5c9:b0:67f:b821:4cf with SMTP id t9-20020a05621405c900b0067fb82104cfmr7255544qvz.68.1703621573782; Tue, 26 Dec 2023 12:12:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703621573; cv=none; d=google.com; s=arc-20160816; b=iK307MKxN0M0I8C/QSfRzWnai0jI0D0jlJjhGmPDGn2KkeOUaSNXrVMSZKCLYsFkRz tYny56W6Ku8wVEc9y7dBjT4uLyJ2QqK06aO9mJWIcri8sv8rhMBmnmMJg7x7d7U2oe8l LZccz28S6nS1w/ISuZBrzUY2V1aBGwq0nDji5MykdEFAGRE0KYIuqSMGVJ3RXVLdHa/P 9uFJPY7lXTvxus7nwALjXPkSYwa68JjwBj6j2wUFqj2F+u6LRlGzQ7csw6S0KxNRV7za MKFzos4vOT486nkBuBtdy6rI3iD23iMMBZ9NSEHN4o7h6kn06bz3y6wTIl6oIhPeazJ4 G8lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=wJwIYEsVQViKfIj+EecPznBxiNi/eUaLQ/D4NQhs5lo=; fh=TXYzuIld3ZUQeXPpec9E/mX9DSWP5fA80EZAZ3xe2Wo=; b=AYXNmcuGM5/6UwN3z6hvEDH+YYzT6DH39uX5cRCKKK9QVPWYIUARHTeE9z/xaSnHHP mxAX2RanQ3ozRnv2BEeeThdXl5efAozkvZqWlFIwlVEllQwmhC97q0+5AfUsis/vTBK4 b8N8RCAjwKF8PSut9zQApqaViwAKlPqu+xKCYZ3JHaBtrQHYxqG59i2DxzivBZvVUCXM bZh+5FsdCAuv6byX132fjs4XXQZx8jGQz8iK0vJF/aAfBTmjtVtgrh5Z8GMcSn+bQbNe kIpXmp2zKTf8OyLYbWh5Z3CgZ/k2zmyTDXIhOzgn4EkxNT7h027ZIPJlYs33UI1yVYJ6 XyLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=abyX8BZR; spf=pass (google.com: domain of linux-kernel+bounces-11680-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11680-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r18-20020a0ce292000000b0067f8c1fcfb4si11266648qvl.166.2023.12.26.12.12.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 12:12:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11680-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=@gmail.com header.s=20230601 header.b=abyX8BZR; spf=pass (google.com: domain of linux-kernel+bounces-11680-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11680-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 871E31C21FF0 for ; Tue, 26 Dec 2023 20:12:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 435AF442E; Tue, 26 Dec 2023 20:12:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="abyX8BZR" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) (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 33CAD23A8 for ; Tue, 26 Dec 2023 20:12:43 +0000 (UTC) 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-il1-f174.google.com with SMTP id e9e14a558f8ab-35fff22678eso3972985ab.3 for ; Tue, 26 Dec 2023 12:12:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703621563; x=1704226363; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:sender :from:to:cc:subject:date:message-id:reply-to; bh=wJwIYEsVQViKfIj+EecPznBxiNi/eUaLQ/D4NQhs5lo=; b=abyX8BZR2waicXr1AWAE0qjnFIc0lUKXX5eC3v08xZaQMHJi3SxUCkUkmWxwD4U1a/ 6yzbci6oLg6V0aRxzrvNrtDqF2plxxXQhtuPMG6r2hiEzHhfI7RyFOnmS51yKvXEj4Jt sotnFeeH//GSRe2fu/bFPMPfcUerliZpVsHgPC4heNyd1dxCtw0ubaDLj5Pdce9L6+Ra ONhtKexFaYTF6AomohYeO8hsnuIgEHeiK3ribVAtYTux5JJ3fr5nHfmg/txHQn/9HQWg URqo/aeC0lej5OlJls2YbSXt/45pSaxwM5bPOB+xsjVlsXDhliwI4sjfUSB6SDgNtTts UstQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703621563; x=1704226363; h=in-reply-to:content-transfer-encoding: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=wJwIYEsVQViKfIj+EecPznBxiNi/eUaLQ/D4NQhs5lo=; b=hIjxHfKJuIYYY6zHmdts8Xjs3m+70Tjkefk5SRN6fs4SJ3HgIsBiX5B0l7++TfE/Iv hEhG17MV+xTpOcxGuHvQzzS9mIOCOn4aCXlawkZuYCEzzfGXa11CVM9l1NHR2eE8A9WS V+40GumdaQQb7wV2I2QR+FFbxO70Qk7Ybj0HVI8Nazl3kj/+zRRV0rhj7EJKFWcwGnaI CV8CMq1SUAoVh6gKoaDJscu5BH/UsAQg0l4EsggxkjjkOJJ8LVqtQEbh3AvgD/FGZUTn 3Tq99XoG1GixE6fZ1CTm6aSG9dvMaM3M14Uy2kXOlXlOg16CnBN4v0NtA/JfnIw2JM/w sDpg== X-Gm-Message-State: AOJu0Yx6Wy+QuYu0BMRdccv63nWrG3tBSpl6zD4UbPKmmHe+EoFW8Nne YDS6lePYIaKGGCuE/nkwuPs= X-Received: by 2002:a05:6e02:5:b0:360:d9c:8777 with SMTP id bb5-20020a056e02000500b003600d9c8777mr2130339ilb.8.1703621563154; Tue, 26 Dec 2023 12:12:43 -0800 (PST) Received: from localhost ([121.174.67.130]) by smtp.gmail.com with ESMTPSA id jg13-20020a17090326cd00b001d398876f5esm10500002plb.121.2023.12.26.12.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 12:12:42 -0800 (PST) Sender: Tejun Heo Date: Wed, 27 Dec 2023 05:12:40 +0900 From: Tejun Heo To: Lai Jiangshan Cc: linux-kernel@vger.kernel.org, Naohiro.Aota@wdc.com, kernel-team@meta.com Subject: Re: [PATCH 08/10] workqueue: Introduce struct wq_node_nr_active Message-ID: References: <20231220072529.1036099-1-tj@kernel.org> <20231220072529.1036099-9-tj@kernel.org> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Dec 26, 2023 at 05:14:18PM +0800, Lai Jiangshan wrote: > On Wed, Dec 20, 2023 at 3:26 PM Tejun Heo wrote: > > > @@ -1498,12 +1539,21 @@ static bool pwq_tryinc_nr_active(struct pool_workqueue *pwq) > > { > > struct workqueue_struct *wq = pwq->wq; > > struct worker_pool *pool = pwq->pool; > > - bool obtained; > > + struct wq_node_nr_active *nna = wq_node_nr_active(wq, pool->node); > > + bool obtained = false; > > > > lockdep_assert_held(&pool->lock); > > > > - obtained = pwq->nr_active < wq->max_active; > > + if (!nna) { > > + /* per-cpu workqueue, pwq->nr_active is sufficient */ > > + obtained = pwq->nr_active < wq->max_active; > > + goto out; > > + } > > For unbound workqueue, it is not checked against wq->max_active anymore > and it is increased unconditionally. Is it by design? Ah, I made a mistake while splitting the patches. This gets added by a later patch but this step should have an explicit check against wq->max_active. Lemme add a check for the unbound path. Thanks. -- tejun