From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 E5C7E313E10 for ; Thu, 14 May 2026 15:26:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778772382; cv=none; b=pqys3BbWOE8WPnANeXH2QZq/BhUvuC80UL1SVFrHd0eqqqNnq/IHFbwQbAIcgFo9C4h3KMzZxGmc9dAaJt76wmGc6YxOyMYhh6TEALNArC+0U1iv1M5//7PXyfZsNvIqfo6phCpL42PfnIvtm0aNUeVg57Dg0o6koQEHREKPnlY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778772382; c=relaxed/simple; bh=8YB8N0YYSQh6PJ8DVEKNfzqLpSnalm07W7AqV/8dVHk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BBbzyUFgZrWzwPbxTnwPXnRkxS8U18UOcTpHGg1V575CcSkOZQpqZVZcZeN0+4aatJ8bj/eJtX8kmlePCFbxak17NNVZOjy9JFni6+fPk/E+JAllWfpNlTyX6AcmZpDy7L4HQsVh6CREa1mpTPbUnjfV8oFU+KhkMJvD9U8B1h0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=jUGBBy61; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="jUGBBy61" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64EAEgsj2760514; Thu, 14 May 2026 15:25:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=Gyw07OAKlrhaYSOzL upHlPLUbBtcjz/n1+6Uox/eCS8=; b=jUGBBy61gIJQbBOXqE26lnH6jwBceg8iN e12FBLJVBr0XIX00DRbBmpQTO/Dr6P1IG+PI3bx4q7QPVfx4Wz/g+jpk2DHuJjdi XAoDLW+XuidKdoazzM9IAQWMclS0y4S0iG8GODTD1zzEvVN6y42PwvMMRytD8AkL Yx5+CAB66Cz+uw2Ym2aDONoXlucoqfzR2+3LvOACeqTw+PYC2hUl4Qv7HD1RGDTl LulaxLinDCddIwIDXH0NjMvm+gPq6YQxFLNXAAVLpq32+ZflGYBd8Tue3+xQann5 XIMG20our5kltmKzJKrdNoDbNKORmRK7+DJYoCCOsgRZJGKgv5DFg== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4e3nv6vjgw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 May 2026 15:25:55 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 64EFPhqV009779; Thu, 14 May 2026 15:25:54 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4e3nfgvy3f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 May 2026 15:25:54 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 64EFPouJ37683586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 May 2026 15:25:50 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C5D7520043; Thu, 14 May 2026 15:25:50 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0734520040; Thu, 14 May 2026 15:25:43 +0000 (GMT) Received: from li-7bb28a4c-2dab-11b2-a85c-887b5c60d769.ibm.com.com (unknown [9.124.213.185]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 14 May 2026 15:25:42 +0000 (GMT) From: Shrikanth Hegde To: linux-kernel@vger.kernel.org, mingo@kernel.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, yury.norov@gmail.com, kprateek.nayak@amd.com, iii@linux.ibm.com Cc: sshegde@linux.ibm.com, tglx@kernel.org, gregkh@linuxfoundation.org, pbonzini@redhat.com, seanjc@google.com, vschneid@redhat.com, huschle@linux.ibm.com, rostedt@goodmis.org, dietmar.eggemann@arm.com, mgorman@suse.de, bsegall@google.com, maddy@linux.ibm.com, srikar@linux.ibm.com, hdanton@sina.com, chleroy@kernel.org, vineeth@bitbyteword.org, frederic@kernel.org, arighi@nvidia.com, pauld@redhat.com, christian.loehle@arm.com, tj@kernel.org, tommaso.cucinotta@gmail.com, maz@kernel.org, rafael@kernel.org Subject: [PATCH v3 20/20] sched/debug: Add debug knobs for steal monitor Date: Thu, 14 May 2026 20:52:04 +0530 Message-ID: <20260514152204.481115-21-sshegde@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260514152204.481115-1-sshegde@linux.ibm.com> References: <20260514152204.481115-1-sshegde@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-ORIG-GUID: SW9HwK6w9deE7LMGgU48U5sHbkSu1y2L X-Proofpoint-GUID: LVgsB4RZZQDxDEzDu7WXCLG8SdpO35WK X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTE0MDE1MyBTYWx0ZWRfX1IZR4Uf+AIdk reBNI4cx39i+ORnneIrDHDD+oqilbogQN+OojV1+0dZfkHwsok5JqcBE/w5xaNksz1jB4/cQ/6z +yRf+UdF9u82OLUlxNZ4uyD6zT+UaIHOKhuF7LWLumCpGvcyY7bfvqcHWnjHzRQXfYhD4EhdbI4 zV6qCnGgP6Aa0Ih40MnCDhMHWeB7EgnkTQfrmmCj3tegr7YNT6PLiK8yFT2KOy9iFsGS7kjRUjh m3ewR3ec3V7J6kEuaIkJkw9TvZw47siM7p1QvwVFTj1XRiCMQvB+vUPxH8OgRRG0r1SoI3LkXP9 EEEamPYqMeEAuUOh8mH96wJFlBisSga+8MEC7UcT1dp7zLzPyxUsbzV0F0evng23iDYb5w/LUaR SyJjRDJ/Wzn+XNIVLFmdsSyxab9iUXbvTVpJePzW6SNyIe3TqK9P8ACDsQVz0l0fUJAvltE702c N/NPcu4eSSIpcKlttnw== X-Authority-Analysis: v=2.4 cv=P8UKQCAu c=1 sm=1 tr=0 ts=6a05e983 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=xkJu8sE_ArotpuPaaLAA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-14_03,2026-05-13_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 phishscore=0 bulkscore=0 clxscore=1015 malwarescore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605050000 definitions=main-2605140153 Add three debug knobs in steal_monitor: sampling_period - sampling frequency in milliseconds. low_threshold - lower steal threshold value (specify percentage * 100) high_threshold - higher steal threshold value (specify percentage * 100) Refer to Documentation/scheduler/sched-debug.rst for detailed info. Signed-off-by: Shrikanth Hegde --- Documentation/scheduler/sched-debug.rst | 32 +++++++++++++++++++++++++ kernel/sched/debug.c | 3 +++ 2 files changed, 35 insertions(+) diff --git a/Documentation/scheduler/sched-debug.rst b/Documentation/scheduler/sched-debug.rst index b5a92a39eccd..a1fddfca2a52 100644 --- a/Documentation/scheduler/sched-debug.rst +++ b/Documentation/scheduler/sched-debug.rst @@ -52,3 +52,35 @@ rate for each task. ``scan_size_mb`` is how many megabytes worth of pages are scanned for a given scan. + +================================== +Tunables for generic steal monitor +================================== +Feature for preferred CPUs logic. Available under CONFIG_PREFERRED_CPU +Files are at /sys/kernel/debug/sched/steal_monitor/ + +enable - used for enable/disable the steal_monitor feature. +Disable needs more than a static branch disable to maintain design +construct of preferred is same as online when feature is disabled. +Once enabled, it starts sampling steal time at intervals specified in +sampling_period and takes action based on high/low thresholds. + +sampling_period - sampling frequency in milliseconds. +How often sampling for steal values happen. This controls how fast scheduler +acts on detecting the changes to steal time values. +Default value is 1000 milliseconds. + +low_threshold - lower threshold value in percentage * 100 +This determines what values should be considered as nil/no steal values. +When scheduler see steal times below this value, it will try to increase +the preferred CPUs by 1 core. Having value as zero causes too much oscillations. +Default value is 200, i.e 2% steal is considered as low threshold. + +high_threshold - higher threshold value in percentage * 100 +This determines what values should be considered as high steal values. +When scheduler see steal times higher than this value, it will reduce +the preferred CPUs by 1 core. +Default value is 500, i.e 5% steal is considered as high threshold. + +Note: When the steal values in between high and low threshold no action is taken +by scheduler. This is to avoid oscillations. diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index f00c08581253..57ba35f7cf95 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -629,6 +629,9 @@ static void sched_steal_monitor_debugfs_init(void) return; debugfs_create_file("enable", 0644, sm, &sched_sm_wr_enable, &sched_sm_en_fops); + debugfs_create_u32("low_threshold", 0644, sm, &steal_mon.low_threshold); + debugfs_create_u32("high_threshold", 0644, sm, &steal_mon.high_threshold); + debugfs_create_u32("sampling_period", 0644, sm, &steal_mon.sampling_period_ms); } #endif -- 2.47.3