From nobody Mon May 25 00:08:58 2026 Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) (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 092E33B27E8 for ; Fri, 15 May 2026 14:37:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778855858; cv=none; b=aXKWUFx3yrb3UlcMFLUohz6epPcgEdttpoFMBkhsNR6s40Y6+ghqxpKYNAgzs3yDtyN1GOuZAq6jIlam/EzgJlcD1YYkhxO3bAA2Pk2V/wD/RzFYFNc2IXXa08OdIU/s/ts8wsVrbNQ1MX9rtGRyS0T30NfpDfDqvOOem6ehCQs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778855858; c=relaxed/simple; bh=+JJ9QoNmTkiGGwv0ilbbrvA8djQkmeNOv9UTJE0rr3M=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=QmHdWppmOD14nstV9A3fZkAIrY5hmtBlOgXcpvId80GY3ChC1hzGzmDWJNQmy9uoKOFUeD7O1AVDgjjrZyjwgpTbxfQ1w0NwY2nwQxIN0JuvIAFfAcdBMwnx7C3VUg+o1sXl2LMj2kLH8HBIy2vQ7aoGMz3vYh9KhONruhPElCQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=goodmis.org; spf=pass smtp.mailfrom=goodmis.org; arc=none smtp.client-ip=216.40.44.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=goodmis.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=goodmis.org Received: from omf06.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 51D6E120124; Fri, 15 May 2026 14:37:35 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: rostedt@goodmis.org) by omf06.hostedemail.com (Postfix) with ESMTPA id E788F20011; Fri, 15 May 2026 14:37:32 +0000 (UTC) Date: Fri, 15 May 2026 10:37:40 -0400 From: Steven Rostedt To: LKML Cc: Peter Zijlstra , Tejun Heo , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , Kyle McMartin Subject: [PATCH v2] sched/rt: Have RT_PUSH_IPI be default off for non PREEMPT_RT Message-ID: <20260515103740.25ccbed8@gandalf.local.home> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: E788F20011 X-Stat-Signature: 5i51dydjd64aj9c395garksq6tk96w1b X-Rspamd-Server: rspamout03 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Session-ID: U2FsdGVkX1/pxpm7Py2MzAb4r5ZDmdTpj9Ab12x0ls0= X-HE-Tag: 1778855852-682607 X-HE-Meta: U2FsdGVkX19vdSYIm7m1VoyQ6SyjhB+YZ6a5XeyEMEGJSXsW8kCYizjc0YmAPN/Xr3TGzPuKixJ9fQZlZ1K4dHUjvSF5t9r8edpMX1U+411QykUB151ohUVwz/Ep5YcFtlppV8G+assBCozVo2NtEGVDhnh0I1dudVCd/4TOqysQqzx4qOnN7L4cPfr4VklepXnC0UCO19TIb9Q280I0S/Q6b6rbYGTZ9HeOWjDDnhjetaSTDduEQfIboN8nNtrhaEU/h61DmGqtB8281xd7mKvk1AM8Vv/8I/iMKyT7HRw15RHDI33d/nmy1v+3nj1aTLiOWVzo+XWUxCC2uH8Q1AlkTwkiBA8bhGhgDnoJLPFXBvQPv+0fTQnGXvKwpzcRgEwrGEjmWig3J0x5a+MSieAsMjTOhU1tWmgrsN581vq21rwwIPgy7BSgxzl1hh/TXfx1k/t7XL68+AV8Y0RHH42z9rOHAhcnTdqVudkWEJk= Content-Type: text/plain; charset="utf-8" From: Steven Rostedt RT migration is done aggressively. When a CPU schedules out a high priority RT task for a lower priority task, it will look to see if there's any RT tasks that are waiting to run on another CPU that is of higher priority than the task this CPU is about to run. If it finds one, it will pull that task over to the CPU and allow it to run there instead. Normally, this pulling is done by looking at the RT overloaded mask (rto) which contains all the CPUs in the scheduler domain with RT tasks that are waiting to run due to a higher priority RT task currently running on their CPU. The CPU that is about to schedule a lower priority task will grab the rq lock of the overloaded CPU and move the RT task from that CPU's runqueue to the local one and schedule the higher priority RT task. This caused issues when a lot of CPUs would schedule a lower priority task at the same time. They would all try to grab the same runqueue lock of the CPU with the overloaded RT tasks. Only the first CPU that got in will get that task. All the others would wait until they got the runqueue lock and see there's nothing to pull and do nothing. On systems with lots of CPUs, this caused a large latency (up to 500us) which is beyond what PREEMPT_RT is to allow. The solution to that was to create an RT_PUSH_IPI logic. When any CPU wanted to pull a task, instead of grabbing the runqueue lock of the overloaded CPU, it would start by sending an IPI to the overloaded CPU, and that IPI handler would have the CPU with the waiting RT task do a push instead. Then that handler would send an IPI to the next CPU with overloaded RT tasks, and so on. Note, after the first CPU starts this process, if another CPU wanted to do a pull, it would see that the process has already begun and would only increment a counter to have the IPIs continue again. The RT_PUSH_IPI solved the latency problem with PREEMPT_RT but could cause a new issue with non PREEMPT_RT. Namely, softirqs run in a threaded context on PREEMPT_RT but they can run in an interrupt context in non-RT. If an IPI lands on a CPU that has just woken up multiple RT tasks and the current CPU is running a non RT or a low priority RT task, instead of doing a push, it would simply do a schedule on that CPU. But if a softirq was also executing on this CPU, the schedule would need to wait until the softirq finished. Until then, the CPU would still be considered overloaded as there are RT tasks still waiting to run on it. A live lock occurred on a workload that was doing heavy networking traffic on a large machine where the softirqs would run 500us out of 750us. And it would also be waking up RT tasks, causing the RT pull logic to be constantly executed. When a softirq triggered on a CPU with RT tasks queued but not running yet, and the other CPUs would see this CPU as being overloaded, they would send an IPI over to it. The CPU would notice that the waiting RT tasks are of higher priority than the currently running task and simply schedule that CPU instead. But because the softirq was executing, before it could schedule, it would receive another IPI to do the same. The amount of IPIs would slow down the currently running softirq so much that before it could return back to task context, it would execute another softirq never allowing the CPU to schedule. This live locked that CPU. As RT_PUSH_IPI was created to help PREEMPT_RT, make it default off if PREEMPT_RT is not enabled. Cc: stable@vger.kernel.org Fixes: b6366f048e0c ("sched/rt: Use IPI to trigger RT task push migration i= nstead of pulling") Reported-by: Tejun Heo Closes: https://lore.kernel.org/all/20260506235716.2530720-1-tj@kernel.org/ Signed-off-by: Steven Rostedt Tested-by: Tejun Heo --- Changes since v1: https://patch.msgid.link/20260515103110.51a598dc@gandalf.= local.home - Indent #else and #endif to match #ifdef kernel/sched/features.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/sched/features.h b/kernel/sched/features.h index 84c4fe3abd74..8f0dee8fc475 100644 --- a/kernel/sched/features.h +++ b/kernel/sched/features.h @@ -110,8 +110,16 @@ SCHED_FEAT(WARN_DOUBLE_CLOCK, false) * rq lock and possibly create a large contention, sending an * IPI to that CPU and let that CPU push the RT task to where * it should go may be a better scenario. + * + * This is best for PREEMPT_RT, but for non-RT it can cause issues + * when preemption is disabled for long periods of time. Have + * it only default enabled for PREEMPT_RT. */ +# ifdef CONFIG_PREEMPT_RT SCHED_FEAT(RT_PUSH_IPI, true) +# else +SCHED_FEAT(RT_PUSH_IPI, false) +# endif #endif =20 SCHED_FEAT(RT_RUNTIME_SHARE, false) --=20 2.53.0