Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2683829rdb; Tue, 26 Dec 2023 01:14:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFR8REKm2IUgYKHp5xVnCngg5ioxhMSOPQoepJJIToc0G3/GeBkmhpEFtjf9sbFG7IiVW1 X-Received: by 2002:ad4:5c41:0:b0:67a:99aa:38b0 with SMTP id a1-20020ad45c41000000b0067a99aa38b0mr10741581qva.44.1703582077963; Tue, 26 Dec 2023 01:14:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703582077; cv=none; d=google.com; s=arc-20160816; b=0NlxbsFPYxOZXOoI+wlfFS6gzqTo0rpCUtzIzN2Q6S1RBWEvEN+x2UN+YUfK2mYutd 0KZh8eGWk+97xDH2sQmfYSkhww8+wh28kQ9seiIItrpTTQqxHecrVjWC2+y5x4wEVZJB 8EeXvzrqpIjxrMpkE5n4Un+1Gr1LhcBCFnn5Sl4+lo9llTMD7v+C0K0Vy5RfSWYPWAdH khciQ5T/2iHG3ePQofex7Ah3rwLdtrARhblgNyJKQVAJHY2N/J5kYPaINLKtuqmmos8Y A8qq9SgFQqOxP9TB1Mt2iwP+O5NSWv1tDLY5vL8mKl2CmEAuj1tJhNH4ZRqhalwQdKb8 /80g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=PqdNpUYpWfyG41yoNqreJFCO9R22bzGQt+dCXZqFMSE=; fh=x4smHwPOFOw21iBdSC3OpOhG6G0fYH4M8HPWFGpCrr4=; b=UFF1ljxhUwnbVVXhavUk6c3uAteGpxlSe9WfAseC9P8GzN4nazUc582xNPzrWqTKrH LHFX5hlt7qq/J2ZzBnFDOf6Ym3CAThTZ0IrszySUGhrlFmDYFt383nTJ4Z/uldAX1sPT jcftGfk8musN9v2Skz/MMtj4mXfGhigxsofG8ETT6ELwTSYbeDVeTYG8PUSgUrfQq+6w l23+Zsbdipsb1Rkzg+YZu3mwdJYJRZI+CaRktm4PeYvUAfxhhAFN/GY2AdJqadzixO2g D51Bzz1l+9fVAoGEpn+HiAPJfcn/P2bHzhJzT3MqaFvcckOF27tSNsOv3pwuRczbhAHX 8lqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=d8FZaENN; spf=pass (google.com: domain of linux-kernel+bounces-11435-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11435-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c20-20020a0ca9d4000000b0067f4f85ec57si11934584qvb.550.2023.12.26.01.14.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 01:14:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11435-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=d8FZaENN; spf=pass (google.com: domain of linux-kernel+bounces-11435-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11435-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id AEF441C21DBE for ; Tue, 26 Dec 2023 09:14:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A44C4D110; Tue, 26 Dec 2023 09:14:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d8FZaENN" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (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 4C3C24D109 for ; Tue, 26 Dec 2023 09:14:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6d99980b2e0so2110772b3a.2 for ; Tue, 26 Dec 2023 01:14:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703582069; x=1704186869; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PqdNpUYpWfyG41yoNqreJFCO9R22bzGQt+dCXZqFMSE=; b=d8FZaENNstOG/1yOK9cPPf0Q0WWiEooVIkcuWS0Jyc68vqYdPufhKKnYpPNdoKA/WW fznjMgHmDVoVg5GfXynsk63n7HdyieFQ7IHDpC55du1zr+DnLhW1SZw8vYk5AEY2f3Vz bkjY7bXAYa2AKv+6vcBctN2MMQ4hSMukUdk4OBcLEvzeCe7Px0OQmvy2URYtzrH4YSzF UXwI4tzVcYSrH/w1sQVdTy4ti82geXICNHlPTaLiLr0smKDUdgQvskPDe9Rco2ClW2Mp Q2J7NjHi+3e4CEk5wcg9FXFsmbEoj8CV/SYNe3s3jKLrhl6RZcd98SOTFuhKO24/h821 YfnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703582069; x=1704186869; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PqdNpUYpWfyG41yoNqreJFCO9R22bzGQt+dCXZqFMSE=; b=qf1i0I0o/hrrkQIPY1xGhxhhdBDSjOEW6FS0ZlNlAtVfeXY7nDUUi5AzoZM1bIOvL+ +fxpNYXTxoI0mkzn2+agj2KDf9DMj69kcb2xZ+lue0XVKXMV18Z+rUOiaOYCkd9x6Jdi xHtJyVTSrsMVEx8zkfm4k/xXcxnHmejvB+j6Z6x33rm2zCScBUa+NApn4wetk0jCD2v7 hGDTV3wkzcJQXxunneg+r+5/l/hB3I7ytCFXlxddb/wXoPdQM0XKWl4Pirlq5t9b1Dyl 3MSXdThJUFpWccsdgN6p/zFWSY2NTDmjbaL7Vp6jSKdX4Kupi+dANG1CFgskLKCRObCP OZmA== X-Gm-Message-State: AOJu0YzQPHNC0emSXw7PMtJqG69vEq9CaNpTfoSz+EWMthl71K+WSNUb xoU7nV8Lu5uA47iOvO4IEKfjgj/c+TBrQUX3evg= X-Received: by 2002:a62:b41a:0:b0:6d9:c090:f836 with SMTP id h26-20020a62b41a000000b006d9c090f836mr1896458pfn.50.1703582069590; Tue, 26 Dec 2023 01:14:29 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231220072529.1036099-1-tj@kernel.org> <20231220072529.1036099-9-tj@kernel.org> In-Reply-To: <20231220072529.1036099-9-tj@kernel.org> From: Lai Jiangshan Date: Tue, 26 Dec 2023 17:14:18 +0800 Message-ID: Subject: Re: [PATCH 08/10] workqueue: Introduce struct wq_node_nr_active To: Tejun Heo Cc: linux-kernel@vger.kernel.org, Naohiro.Aota@wdc.com, kernel-team@meta.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Dec 20, 2023 at 3:26=E2=80=AFPM Tejun Heo wrote: > @@ -1498,12 +1539,21 @@ static bool pwq_tryinc_nr_active(struct pool_work= queue *pwq) > { > struct workqueue_struct *wq =3D pwq->wq; > struct worker_pool *pool =3D pwq->pool; > - bool obtained; > + struct wq_node_nr_active *nna =3D wq_node_nr_active(wq, pool->nod= e); > + bool obtained =3D false; > > lockdep_assert_held(&pool->lock); > > - obtained =3D pwq->nr_active < wq->max_active; > + if (!nna) { > + /* per-cpu workqueue, pwq->nr_active is sufficient */ > + obtained =3D 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? > + > + atomic_inc(&nna->count); > + obtained =3D true; > > +out: > if (obtained) > pwq->nr_active++; > return obtained;