From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 68A80311C1D for ; Fri, 5 Dec 2025 12:56:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764939388; cv=none; b=T2Gm4A1fIJWtHhc8qV31jz7nFafza7Lb2XvR0GKqfH5a7Rad8Y9RhzqzRZVq3QR7c0IDpNM4vJmjgPfz1hvfHiUsa/qNFEvnPT9fxKeZouWLFWcZeQUA5ZLqv5sfOKhc7HAby+X2wxTU9hy41Q7xkIw4aR/Nrf6XUsSs0fIvceQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764939388; c=relaxed/simple; bh=hg8uAiIvjgWd3F5NANWd9BmGGd9e1Wj8wVq0KdukTqo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=a9U5AaHAabfir0dLXKt7jX5uKhSQ8Hbp7CQWis9rks16H0nSCTAfhmgnA0E65dtTprywHyqfFBcpq7Vjpz+PoHig+Nq7wGPHoNiPsDrsja/ApZ0kw2jVqhOctbzmKV3/WG4WN2fJA6PZPkSYUFz6YSD1imKFk5NbgGlw1w/Xn7E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=mSZevBuN; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="mSZevBuN" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=217E5JB3zPUzwb96HCX8WO/LhV8qpF5tpRQOfpnQ34U=; b=mSZevBuNbhexeKjWKA2qBL2sI5 UzMBb089CsW1tDc30potGsyyiozU3K8UMHb3bGhHTEJbYSvAxMC+mQhtYrjqUG42I1Az0ykBrmqN1 PkA1C1fv8pQVoK6YR6KtJfaH2lDhRuH4Z5WZHWGdCCDiFcRhcfjSo2GroHDuPK9KDvf+YWoQh1mjf fomktZ/Ruzu+ETamR+qUmvUoR11BXRf/mXaXDM+gLIizLWadxvryXeFbokz3JpaxgVJwSOb6shJDm 4JofxN506GSg0YXkhVRQJALNONVnayZd2FNjrQyTmw3DQKhvKUFImtc3gm+16tuym6gtoUydATSWo 7BPGNB0A==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vRUUS-000000061mn-3TFA; Fri, 05 Dec 2025 12:00:48 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id E425230027B; Fri, 05 Dec 2025 13:56:06 +0100 (CET) Date: Fri, 5 Dec 2025 13:56:06 +0100 From: Peter Zijlstra To: K Prateek Nayak Cc: Vincent Guittot , mingo@redhat.com, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, linux-kernel@vger.kernel.org, pierre.gondois@arm.com, qyousef@layalina.io, hongyan.xia2@arm.com, christian.loehle@arm.com, luis.machado@arm.com Subject: Re: [PATCH 4/6 v8] sched/fair: Add push task mechanism for fair Message-ID: <20251205125606.GA2528459@noisy.programming.kicks-ass.net> References: <20251202181242.1536213-1-vincent.guittot@linaro.org> <20251202181242.1536213-5-vincent.guittot@linaro.org> <20251204112947.GK2528459@noisy.programming.kicks-ass.net> <20251205085912.GQ2528459@noisy.programming.kicks-ass.net> 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: On Fri, Dec 05, 2025 at 06:19:07PM +0530, K Prateek Nayak wrote: > On 12/5/2025 2:29 PM, Peter Zijlstra wrote: > >>> Why not use move_queued_task() ? > >> > >> double_lock_balance() can fail and prevent being blocked waiting for > >> new rq whereas move_queued_task() will wait, won't it ? > >> > >> Do you think move_queued_task() would be better ? > > > > No, double_lock_balance() never fails, the return value indicates if the > > currently held rq-lock, (the first argument) was unlocked while > > attaining both -- this is required when the first rq is a higher address > > than the second. > > > > double_lock_balance() also puts the wait-time and hold time of the > > second inside the hold time of the first, which gets you a quadric term > > in the rq hold times IIRC. Something that's best avoided. > > > > move_queued_task() OTOH takes the task off the runqueue you already hold > > locked, drops this lock, acquires the second, puts the task there, and > > returns with the dst rq locked. > > So I was experimenting with: > > deactivate_task(rq, p, 0); > set_task_cpu(p, target_cpu); > __ttwu_queue_wakelist(p, target_cpu, 0); > > and nothing has screamed at me yet during the benchmark runs. > Would this be any good instead of the whole lock juggling? This will get schedstats and any class with ->task_woken confused I think. The IPI handler (sched_ttwu_pending / ttwu_do_activate) is currently only geared towards doing the remote bit of ttwu. This is fixable of course. > Since this CPU is found to be going overloaded, pushing via an > IPI vs taking the overhead ourselves seems to make more sense > to me from EAS standpoint. The performance characteristics here are very platform dependent. Sometimes raising an IPI can be very expensive in and of itself. > Given TTWU_QUEUE is disabled for PREEMPT_RT, I'm assuming this > might be problematic too? Yes, you have to check TTWU_QUEUE and have a fallback.