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 1CF553655C3 for ; Wed, 17 Jun 2026 17:44:58 +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=1781718300; cv=none; b=kkTtti0fxxwmrkp1cIWlauYZ1HwpLFUkDoNXtQuurqTXpUGhTIwQWIXzASxpDwKegwzPKaOVJuWbgQiyf71fk9eDGp4WS1eSzZU+9G3qAfl0+70/syTlKfWT/uRHfCTtevsTBkB6C1vq7d+t9Ayf3DmARsc/3iV18Pc/ono33g0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781718300; c=relaxed/simple; bh=CVyyXhLYJnxUVYQq+RNYBFTE8McY2THFQMB6JfHJ2uk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q1oG9w6L7sR2NgQX6c0zzWoyGWCIvZOdXJaI6WUobZS/hfr4CN/iwMp28YMIeLfHquq4UFc9PomILLym9A5HDoFTdR6/r181HABkA/m79ReEPAunmeR3gBSe27KbR2UKFwFUYc30JP8FbJi4NNm/9Ok84qp+qjp50F3GdnPva+8= 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=KIS/bwPT; 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="KIS/bwPT" 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 65HFpflW723588; Wed, 17 Jun 2026 17:44: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=imMEK6GEWfxioFlzw vfVskyflOCXUvsmtA2wGuUpCDw=; b=KIS/bwPTmmVRoT5yT950zhJ1JfjvqiJIu iCYa+DMtc8Etmmx3Fsy9AybSFvkalAVXqoZHk1TxIUogI5LfD9g49+trlSwtsaM2 NsPLhFfWu79Ds/Vz8bTaO+hqicxJDaB5LqduA/6Dm2ICH0jIxOAsIrZGEKF+GY/b Ya2EPLjFgJR8+KYwFHbnALTYFhsUhr0YAx8rXHaIUS8xDZ5991OzNKxE7WLeuboD uW2Hmaed7QNuLkySblAG6+5EvMxiUACBeiwjI8p8uv85vwJtlfRC7x9F+PjOVR0+ C9eLCkN2o6T5/Zr/jS0XMnNOf9eeFl2ch3nNhwNYC9QOHAh+C/EfQ== 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 4eueqx470f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jun 2026 17:44:56 +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 65HHYc4W009726; Wed, 17 Jun 2026 17:44:56 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4eudvacbnd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jun 2026 17:44:55 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 65HHisWX49545630 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Jun 2026 17:44:54 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E072520040; Wed, 17 Jun 2026 17:44:53 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C72C920049; Wed, 17 Jun 2026 17:44:46 +0000 (GMT) Received: from li-7bb28a4c-2dab-11b2-a85c-887b5c60d769.ibm.com.com (unknown [9.39.28.77]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 17 Jun 2026 17:44:46 +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 v4 19/20] sched/debug: Add debug knobs for steal monitor Date: Wed, 17 Jun 2026 23:11:38 +0530 Message-ID: <20260617174139.155540-20-sshegde@linux.ibm.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260617174139.155540-1-sshegde@linux.ibm.com> References: <20260617174139.155540-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-GUID: mA3O2jf1BZCCJsN-D4w1mw71NImepT2A X-Authority-Analysis: v=2.4 cv=Le0MLDfi c=1 sm=1 tr=0 ts=6a32dd18 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=xkJu8sE_ArotpuPaaLAA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNjE3MDE2NiBTYWx0ZWRfX0yu8TLzWSTJj hKuWEN9zG+BYSaQpjMLUSi7vZ6cuKrAcTkGvsPxkIPLhpk5ku/hx78LCWBNOTAysZW+KJUZQ/QT qWob5llSYcy0AH74Sy5cOYalbqYDIXY= X-Proofpoint-ORIG-GUID: mA3O2jf1BZCCJsN-D4w1mw71NImepT2A X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjE3MDE2NiBTYWx0ZWRfX3CwJxpaszsNV l7HcDB0qzLrg/a8WsTrHNHLAXEFYkXKzBewZebN3dZYmDwVUZfuIUbgmaLD3diXIPJRsEIzhV/G DMvEYfaQ/NTJqcak7dMiTotC0+cSPNXPYrP9VFz763u2zU0rP8u1DV8Cg6WHLKmhoFL+/nE2ngh hFLKgD8Ivv2kyWfKwhQJvuej0EiTcS2ose32tkBiQgPyWdyus3KZHcCDpAkfNqKbrm5BPDyS5/f 6oatN+xxae52DSYSCOZejB87BOa1aon0V5eb4jZWqPlqWR7ocG6HrFJCnqopd2HgCN0hOWUOhjx pLe0BRFJbD2xlJJn3EDISxri1WARwBGTG9Rt3bopXMU5GuN3Ep9NYqwc0zKZpKTaGaplX0KOU9R LEgL/ROfpmpyX7i7NeAlL8N2BvY3OVg42wBI8zagnimEVXSd8FE0advN1Q4hVTf/D9xSqtCeWjJ mw2C8gzXzPeERI2fNww== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-17_02,2026-06-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 malwarescore=0 spamscore=0 suspectscore=0 impostorscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2606170166 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 | 34 +++++++++++++++++++++++++ kernel/sched/debug.c | 3 +++ 2 files changed, 37 insertions(+) diff --git a/Documentation/scheduler/sched-debug.rst b/Documentation/scheduler/sched-debug.rst index b5a92a39eccd..95c355b1aebc 100644 --- a/Documentation/scheduler/sched-debug.rst +++ b/Documentation/scheduler/sched-debug.rst @@ -52,3 +52,37 @@ 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 active 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 or equal to 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. +One needs to be CAREFUL when setting the values. diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index ae7a641931d1..7a9905009ede 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -674,6 +674,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