Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp63794rdb; Thu, 25 Jan 2024 08:18:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHi5tMrQavmn/g40qRgiE0HD1ou+lA+tNw9OCKS3VK6OzZ4adhO2TZLNlNvJAInm/OOcdhV X-Received: by 2002:a05:6402:310a:b0:55c:7aff:b456 with SMTP id dc10-20020a056402310a00b0055c7affb456mr809232edb.17.1706199506114; Thu, 25 Jan 2024 08:18:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706199506; cv=pass; d=google.com; s=arc-20160816; b=0s52cZC8TqeZtDQfiPX3tIHKZQH7TPYxSLN6tSto7P/q+xidWn0/wFRalKnEo9zgZd KMuI9UYSmGSnTLd7sav34u8WaVDREsO1WmSPf99JTGVS/mnAWfzGcA+vaXSkImQGxPT1 vBGW2uXVXWQNKbKeYDeZB5xnVyKfgYogtuMxokf6/BFziU4mL79v2nSsXB01bXycCTUI vRKeraw3fRZTZZyqG9Ja4FLAADBgBFJPQLao76eaQ2Hy3g23dQ5IhndxXfXQrnBgJqfT 1gjeWBDgUwv01NLxXBB/99KQY5YDWvpA9lPHAA4AgW+ArpTLLCOTBAVNwcKybDn3/1I2 uL9g== 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=+MoEmBbzGBVk8q97dYyCdtd+kj6HEalfHfdlRpBuITs=; fh=TXYzuIld3ZUQeXPpec9E/mX9DSWP5fA80EZAZ3xe2Wo=; b=UnTYjdw+DRMz5iBuPJfrFNjNJAOPvtdAEDrcBX0SP4dFGami0NrREijuntPCmvCKJ0 +3QRBB4q3hUbAYJux4jZAtQREJhgz2zgrB5fHQS29HbtUQ6y+9w5Ipe39IJSWjAwnO3D 6EFSRAP0nbmAY2t3RLyjKnQWrh3jNGCKjfQgZCCV3j7PJ2aQtSHnVM8A9gmn6Vuqb8qs MzjARcvPvi0LUknKOrlzUPmSBS0LiYqfBRdlBKdMlTXlhvLeyUTbOHP8f1YaB0Gj7rS0 /MzTi0/8sWCfdXGGb/4gNo2wpPZKQZOaJBsYK5rroq5hFbUXflJNw7DoDBMs08xpDnwW rMvA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HpWot5ru; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-38880-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38880-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dz10-20020a0564021d4a00b0055a8cdad66fsi6454287edb.535.2024.01.25.08.18.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 08:18:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38880-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HpWot5ru; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-38880-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38880-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 am.mirrors.kernel.org (Postfix) with ESMTPS id DCCEE1F27459 for ; Thu, 25 Jan 2024 16:18:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB71A129A66; Thu, 25 Jan 2024 16:18:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HpWot5ru" 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 A7A156EB64 for ; Thu, 25 Jan 2024 16:18:16 +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=1706199498; cv=none; b=bLGr7tp33BcVQCxmxp+FnOORlYenCipR6yEMOglM+pS6UTFks0g6uQZsCmmqjBYYq0Ivf052gg8OcCNtoWhk6on0XRYIOVj6V1021NcrjOwy5OsFia1DvFTsDhqw8csNob+Kvn7oWV1ZnAxBJam1jDVgvKeVUYxixgf1Fx8rDTc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706199498; c=relaxed/simple; bh=WoVDPF/mMUTc/TdVb1Vqz29n8UJqHd0WHp/NcXLoLNQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZSBmEHIodS5BnQQiBatRHUtjOAImSsZnGj9QeGCdAtlycmpwmv2Jag/v+Wrv1rdjTiI8XertETvXDsBdw/oVqPB29X90FzcK0wd+oq9W9eOB6/U4EouggFPjqVcqySbWtXpE7uGaVSCgwzqGbdLeMJUt2kVDisJM64h922Q/Hwo= 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=HpWot5ru; 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-1d71c844811so36964995ad.3 for ; Thu, 25 Jan 2024 08:18:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706199496; x=1706804296; 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=+MoEmBbzGBVk8q97dYyCdtd+kj6HEalfHfdlRpBuITs=; b=HpWot5ru83/5f/Hy8GHZNMfdYBrHj3y96Chcizl8TnSXQ7z9C/0pHh6Glp+vYsJDs5 WnCtHgd0YVH2yefVf3nLOiK85vmqhlzSBpnA9azCgzLBBrIO8zPGYyV87X4TzIN5+4cC tddyAZvsN94VrKlGKpFaU8RIdxGvb6GoGm8ZmLmQoxzgLWUtU+BhnLVAwx1ycAjr1F91 xirfBNvxazOc5zTOLfihgyc6AW3mbhbixmRUXZimdgtxX80bwbFfBi7S8r/CFWQtrRxv 63c+cinhD8oqeYFMhRSVQW4eTHzmRiyvmycBW/1f8wuh0eDvjFxBUFbZR4awptm3M6FF csfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706199496; x=1706804296; 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=+MoEmBbzGBVk8q97dYyCdtd+kj6HEalfHfdlRpBuITs=; b=OfENCVsGX+OocAHz5L8teVleb7XpqSEZ1tiJ7gF3NZbos9vK2NyILVaNBGc00XTijU 5k0aLpWl7fL7lslDREPpH1jzApp7xZMiiAJcgaQdIm49wsT0GNI5oW3v1SD9p7hhZvtD f/10rQmLZrB+ue8NI2n6ChAHONqLhHAj20X5n5q1i6gKPMk9Z/+utJHJCBKuxg7mUUPB iQu8NC07UYMSC33hWgITuSarlksXD3Uzwm7BY//kOjnCVwDvawdQs6ct98H5ebmc25dB CrGB8jWWUI4gaE0cyYfEJ7xNF87Dxf+BxDAx0HJHbC3mpvlqLv26ViTvofvquO/9et8D CMAw== X-Gm-Message-State: AOJu0YxvX9T/yyZprrxeDLV5oUSbsy6Gx0lIIwHROIe9e6kS0sL01XzF IQ6b+c0hAkNoTSAWZ39QqyOFSJSQqiMgMMBCbqjw1BiUBExxTUS0 X-Received: by 2002:a17:902:ced0:b0:1d7:7664:f2bd with SMTP id d16-20020a170902ced000b001d77664f2bdmr1333892plg.2.1706199495810; Thu, 25 Jan 2024 08:18:15 -0800 (PST) Received: from localhost (dhcp-141-239-144-21.hawaiiantel.net. [141.239.144.21]) by smtp.gmail.com with ESMTPSA id s20-20020a170902b19400b001d72f145ebdsm8745815plr.35.2024.01.25.08.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 08:18:15 -0800 (PST) Sender: Tejun Heo Date: Thu, 25 Jan 2024 06:18:14 -1000 From: Tejun Heo To: Lai Jiangshan Cc: linux-kernel@vger.kernel.org, Naohiro.Aota@wdc.com, kernel-team@meta.com Subject: Re: [PATCH 9/9] workqueue: Implement system-wide nr_active enforcement for unbound workqueues Message-ID: References: <20240113002911.406791-1-tj@kernel.org> <20240113002911.406791-10-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=us-ascii Content-Disposition: inline In-Reply-To: Hello, Lai. On Wed, Jan 24, 2024 at 10:54:26AM +0800, Lai Jiangshan wrote: > If an active item for a PWQ is canceled, the PWQ will lose a hard-earned > nr_active and have to wait on the round-robbin queue for another nr_active. > > It seems it is unfair for this PWQ. If a user's program pattern is > queuing-checking-cancelling items, it can cause delays for other users > sharing the same workqueue. pwq's get RR-queued iff there's congetion in the workqueue and when an inactive work item gets activated, it gets dispatched for execution right away. Note that for unbound workqueues, need_more_worker() is always true when there are active work items on the worklist. ie. The only time there's meaningful time window between a work item getting activated and starting execution is when more workers need to be created and the system is under significant memory pressure. Note that the former is always a temporary condition as we retain workers for a while once they're created. IOW, there's no meaningful time window in which a work item which was activated after waiting on node_nr_active pending list and then can get canceled. It's a possible but fringe scenario which won't happen in any meaningful frequency and even when that happens the impact isn't much to worry about. I don't think it's a good idea to add complications for such cases. Thanks. -- tejun