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 3166D24503B for ; Tue, 7 Apr 2026 19:23:54 +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=1775589836; cv=none; b=lcszy27rDSiJ9vAd3KJXgSq2SvKBHfmbSB4EOa/QUeuZL/SQDRH1zroKiXtp3zAc2pRTyAqHE5hKqUfCKTrkJhiiAqrv7kujDY/gHBXcEQvEhPRhAld7n+foOPylr7CoDBiPf7/6i59maFZgCYNto8Ww2YzUrM3EK9dSB5Vf350= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775589836; c=relaxed/simple; bh=3SSdEmZCO4ts0gQEEB0IzzevgJ7cF1m3FOdCBxzvQhY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GX2ZqRmx+dYAq1FInJiM8+ye3irCgyDYjSMN8q4QMPkU5za4OKEDzIMnddIlTqPb6XDJAW+kzuGuWSxH4wss3hYtNCGuliYHs2JpYG/qUbCSJNpHGh8zE7iLxxBciNgL88N16rTxgW1bmeW3Zz3xXR6BHF3hy+3gtVJ1k7LxDNo= 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=FhigagFf; 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="FhigagFf" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 637EEK1u2212446; Tue, 7 Apr 2026 19:21:40 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=V5hQT/69n97KiIh0z k/d7u+CGmBeXGPSFMpglBfjPGI=; b=FhigagFfGTnEWlUYqWQ9ZeIAma/qleBnd 8arFwhMTCzW7+29GMPpq1DNq+wxtgnoRRLrReX3i9Dg7ZLopPeaqFKjU22gcYJQK qA8ea1OmZ0hVTmy8t/2mSMAKLTDdBMqTDg2FqnKLArjkFBHLQBL9ijH7ZN6bh5dJ icJcw1+wmfaudojt1wbtYUQzutG9qHC64t5maMdZuTaBnok8iIKDJRmAIp5eYAzl XUW/yVJXjANx7GmVl+k9FLVFt0ymWNLnSsabrK88GpOs0DXw4Gc8Yuuoe7EdL4oC sfKGxIkQtD1yB0lUc5hggMQ5XRT9dl/vOEb4qY14NebS2+oZVydsQ== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4dcn2hcch5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Apr 2026 19:21:40 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 637IYtOu019008; Tue, 7 Apr 2026 19:21:39 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dcme9cjyb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Apr 2026 19:21:39 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 637JLZ7H30474556 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 Apr 2026 19:21:35 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 787F52004D; Tue, 7 Apr 2026 19:21:35 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E2EC320043; Tue, 7 Apr 2026 19:21:30 +0000 (GMT) Received: from li-7bb28a4c-2dab-11b2-a85c-887b5c60d769.ibm.com.com (unknown [9.39.20.194]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 7 Apr 2026 19:21:30 +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, tglx@linutronix.de, yury.norov@gmail.com, gregkh@linuxfoundation.org Cc: sshegde@linux.ibm.com, pbonzini@redhat.com, seanjc@google.com, kprateek.nayak@amd.com, vschneid@redhat.com, iii@linux.ibm.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, joelagnelf@nvidia.com Subject: [PATCH v2 17/17] sched/debug: Add debug knobs for steal monitor Date: Wed, 8 Apr 2026 00:49:50 +0530 Message-ID: <20260407191950.643549-18-sshegde@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260407191950.643549-1-sshegde@linux.ibm.com> References: <20260407191950.643549-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-Spam-Details-Enc: AW1haW4tMjYwNDA3MDE3NSBTYWx0ZWRfX1sWGBDwrEeZE vAYQDy42KX84ZYrjmUr6GkWrt2yZi1dUtLUZGFGgFFM5lB7bp1BCjFR0XhpNsx+VtSrO7sVyioP e4PX1w1DbnSODE96Ngrp8pi/+oxloHI470Ndk0V0OzksFP+kX4EsaiSi4pi/owgDx6cnjOZgGpz XRlqjMZwe5ylIk9SfJth5xwEPXdeYxJb0YpsZNYSxp4BDQjK4W+YDCexca3N8UQsWiH08lc6koK QIeE7UjAu6MrBRitaBxrDEaZziKy5a9Q0YUGSGq0NzNK5IMTOqQvjA2lLHBQteC3C7mdn1sy/PY e5dTw++qAciQizAc0P/7uxPZwf+GmiBis/EGiF4XsQHBczj+lP9RmBNLf55wQl/o5+NA2h4SUY3 EXfRMCy6MPpOZeDmsup3l+doizJ+4p6eO5mr/OHUccn4IYHIQev9JF7WIGbxl/v1Bm7hpcp6/Wq Nn/dEmhdBj7vwLgRm/Q== X-Proofpoint-GUID: chtxJZwdkrOMRAPyOlgHWTJC3EUT_bxS X-Authority-Analysis: v=2.4 cv=a/wAM0SF c=1 sm=1 tr=0 ts=69d55944 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=UD3wv6VuSr2BVd-_4AcA:9 X-Proofpoint-ORIG-GUID: xuf9VrGGha8q8Gm99YSbz2eN7zxa_E5_ 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-04-07_04,2026-04-07_05,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 spamscore=0 impostorscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604010000 definitions=main-2604070175 Add three debug knobs: steal_mon_period - sampling frequency in milliseconds. steal_mon_low - lower threshold value (specify percentage * 100) steal_mon_high - higher 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 | 27 +++++++++++++++++++++++++ kernel/sched/debug.c | 6 ++++++ kernel/sched/sched.h | 2 ++ 3 files changed, 35 insertions(+) diff --git a/Documentation/scheduler/sched-debug.rst b/Documentation/scheduler/sched-debug.rst index b5a92a39eccd..288cd2c63224 100644 --- a/Documentation/scheduler/sched-debug.rst +++ b/Documentation/scheduler/sched-debug.rst @@ -52,3 +52,30 @@ 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 +================================== + +Generic Steal time monitor can be enabled by selecting STEAL_MONITOR in +sched features. It is disabled by default. + +steal_mon_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. + +steal_mon_low - 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. + +steal_mon_high - 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 too much oscillations. diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 482c86a0ff80..9a6c1ada2cec 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -612,6 +612,12 @@ static __init int sched_init_debug(void) debugfs_create_u32("migration_cost_ns", 0644, debugfs_sched, &sysctl_sched_migration_cost); debugfs_create_u32("nr_migrate", 0644, debugfs_sched, &sysctl_sched_nr_migrate); +#ifdef CONFIG_PARAVIRT + debugfs_create_u32("steal_mon_low", 0644, debugfs_sched, &steal_mon.low_threshold); + debugfs_create_u32("steal_mon_high", 0644, debugfs_sched, &steal_mon.high_threshold); + debugfs_create_u32("steal_mon_period", 0644, debugfs_sched, &steal_mon.sampling_period_ms); +#endif + sched_domains_mutex_lock(); update_sched_domain_debugfs(); sched_domains_mutex_unlock(); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 337357e48a83..850d944b22f4 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -4149,6 +4149,8 @@ struct steal_monitor_t { unsigned int sampling_period_ms; }; +extern struct steal_monitor_t steal_mon; + static inline bool task_can_run_on_preferred_cpu(struct task_struct *p) { return cpumask_intersects(p->cpus_ptr, cpu_preferred_mask); -- 2.47.3