From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 D4BCE470E84 for ; Wed, 22 Jul 2026 19:05:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784747132; cv=none; b=SftO+rl8IjECek9xGSJrmOhe5z5q02boIPElHpP41FE3cCvZpQi2F2S7Xwf1De1+YQTU+lNDWT14MzlrrwdbgN1wweVArh4nqSnwjtg6IOJGnGYSU/W1Kn8SXPt6qD+OElsxUFPk4BVgiTSXpr+zjRA6wNTrk0pXru+uxS4LHo8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784747132; c=relaxed/simple; bh=qc6Cm3lAT/1ED0ucLM3ZoW+7pP8OBUQ6R38IbTLJiN4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FwVEV3To48uYVzH7XyutHjRLChPUwVAvky7gXLGxhyYvseHPffmXeq0mL86lHJ8yhor085ag9tWyrmlqGzW6HPxN8SUFXKCZbEBDJPKrNpG2oXpl4VlTEv3G0whfBGVJfRL0YPgsQrFJxbpgGCGbaaeV5bBPrMJn2TdyKCmuBDo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EaV3/ZS/; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EaV3/ZS/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56C2F1F000E9; Wed, 22 Jul 2026 19:05:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784747131; bh=GTNAXQzdEcbikbTOwRyr/U5VO4eOAsomxKg31uWGKSU=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=EaV3/ZS/pnK9IyioF7sZu71ZXWKcCuseQeNEOler0qJsQybEeMHvqSLpX36aGhTeK I+Pd5YmgNsjh1XKY/exNanP/Wae039RRmCV4eACmCxyVWCArBg2D9wpSkYJgOGc1YB 5zSDgltbZAin3kxbd5qO6jWXx0zkpTCW8raa8XT7Rxaj1FANnHr3SCB6jlUXz2xfQr eEFI7ODz6u7YyBwRIsOfd1aW2Dpn5JDWezLPP6x11DqKYqWy9e369sZiSarUcoJ4Yl iWstcuQEwTF8jtWqdz1gBuw5Gw72/0bPAu7vXIBJrL1/3eOnuGGdtR5jjKPe4+j4jV PIX3vCuMZBaDw== Date: Wed, 22 Jul 2026 09:05:30 -1000 From: Tejun Heo To: Tvrtko Ursulin Cc: Tvrtko Ursulin via Kernel-dev , dri-devel@lists.freedesktop.org, Boris Brezillon , Steven Price , Liviu Dudau , Chia-I Wu , Matthew Brost , linux-kernel@vger.kernel.org, Chia-I Wu Subject: Re: [RFC v3 1/2] workqueue: Add support for real-time workers Message-ID: References: <20260717090209.26931-1-tvrtko.ursulin@igalia.com> <20260717090209.26931-2-tvrtko.ursulin@igalia.com> <8dffe078-ca2e-4d01-96b3-f1709472ef1b@igalia.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: <8dffe078-ca2e-4d01-96b3-f1709472ef1b@igalia.com> Hello, sorry about the delay. On Fri, Jul 17, 2026 at 11:06:55AM +0100, Tvrtko Ursulin wrote: > > + /* > > + * Do not consume all CPUs with RT workers to avoid scheduler > > + * starvation. > > + */ > > + if (pool->attrs->prio == WQ_PRIO_RT) { > > + unsigned int max = num_online_cpus(); > > + > > + if (max > 2) > > + max = max - 1; > > + else > > + max = 1; > > + > > + if (atomic_inc_return(&total_rtpri_workers) > max) { > > + atomic_dec(&total_rtpri_workers); > > + return NULL; > > Sashiko is warning me here this can create a deadlock when called from > maybe_create_worker(). My apparently naive idea was that this would make it > wait for a bit, until the load on the currently instantiated workers > subsides, at which point need_to_create_worker() would say "not any more" > and allow it to exit. > > But even more importantly, it is also warning me that strict CPU affinity > creates per CPU threads. > > So my idea of global limit will just not work. > > Tejun, how does this sound to you? Are you okay without having the global > limit of RT threads? > > I will await sending v4 with other fixes until we can close on this one. I > also have some vacation pending so there may be a delay in my replies. I don't think we need to limit the total number of workers. It's not a meaningful protection anyway (is it ok if max-1 CPUs are pinned in RT?), the DL server already provides forward progress protection, and it doesn't make sense to design this assuming malicious / incompetent users. Thanks. -- tejun