From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 5F90E33F8D6 for ; Mon, 8 Jun 2026 16:26:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780935990; cv=none; b=vGOd7SKebJzBhn1zXciNBh8ySCKRdF/bxw1YkmfWs2Y6Pb/onoSxtnUmfd8o70wICMIUV0wd+SZx/TYKCtCz4+y+OC+gN3jN8Ryr7Ds+OzAHu0yb/fuySADZvX+3z7E1W0iiKMTllSKZA6osZV4S1O9CT5DR3Uhv3fvRnYAuDbI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780935990; c=relaxed/simple; bh=EMgSY0/2RmBqr8Z1YkF3lQuL54vVibTdeIbiiv7E7GE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=r/xz9ftcqlgYJzxCQs7s1ZbSwqeWySiMP9kpPvl+bERIFOkOm1Kj4amSIH9Ms8eCOQude/ALGOcs7Ev7UkN9lO0yp+gANMyI1DKWHfIa9hMMpOVFfOUjpSU4tRGO1Gz5qZXoX7JLyUxKAMmEGrm1O2W/f9NRBlxRQ2AGuhSZAdk= 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=PEbFWpKf; arc=none smtp.client-ip=148.163.156.1 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="PEbFWpKf" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6588UeO51477263; Mon, 8 Jun 2026 16:26:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=sV5JRr FUlP8u5D656fUZlP5s7DbSJGQZF6NS9dllnZ0=; b=PEbFWpKfXbqVkHpXhO3ITz xQBGK+L12OZ2AD09mD8Sjkz0HwXlXuUixqWDzcdeMYdAM1refPlV18aYUYhE4fjH eOLLu3i1v5nMVDBlJX45wNhvq7C/83qZYNcnTMrsQy0L7Ow8yhgpgAcJC7p0q/2U L6yc+zrPImnGRKu4qRIAnN30W1e9uEfxOMex87Jwp5f31zetwC8mynDR8ZABNqcH UVYGVyZ1uppvBz3SImTJYu1Qjf6VOCnz8s3Vtq7xt8YMqcoMTpju8yoo/MiHTP5j TbetpqXawZlED5DfasUfM8WbA+apYpc2xNn/GRGQu5eBmcES2Md3zN+ZZJjJIsVA == 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 4emb7qg7f9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2026 16:26:00 +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 658G4e5T004504; Mon, 8 Jun 2026 16:25:59 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4emxvjp4gy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Jun 2026 16:25:58 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 658GPtOp22479512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jun 2026 16:25:55 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E82AB20043; Mon, 8 Jun 2026 16:25:54 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1C7E420040; Mon, 8 Jun 2026 16:25:53 +0000 (GMT) Received: from [0.0.0.0] (unknown [9.111.15.218]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 8 Jun 2026 16:25:53 +0000 (GMT) Message-ID: Date: Mon, 8 Jun 2026 18:25:52 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 15/20] sched/core: Introduce a simple steal monitor To: Shrikanth Hegde , 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 Cc: 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 References: <20260514152204.481115-1-sshegde@linux.ibm.com> <20260514152204.481115-16-sshegde@linux.ibm.com> Content-Language: en-US From: Ilya Leoshkevich In-Reply-To: <20260514152204.481115-16-sshegde@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Authority-Analysis: v=2.4 cv=HppG3UTS c=1 sm=1 tr=0 ts=6a26ed18 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=dYCa1OlNftm_6-mUV2kA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: Y-5yqbvZVQ9QZFs08lEZRsZjln2Rd_Ti X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjA4MDE1MyBTYWx0ZWRfXwiT55+MN4n3g 0b7KSx7WKCU7Qtn+fzCK42r4JtjBV5GdfRcwmvTjOFxG5+Aw8RF5nOGsP4Waxx4NaLQ/UXFyOaG Jp7tjOBQeaFYHh3DTkUMvSXzhX96+5qDo+tUVGpf56Tsu3vJoS8vW1d6+Q6MNGQeC7z0z5P9MKl /sxScRj4cyS6VrzMI4eRS8TzYRIyxvMBw9KRr5x3XR0mxue8cLpRMgbHKKrBJ/Ko46YWEdRMdg5 8LUSUq9jF6NM682zN1hchf5PWc2m+VQS+Vke+zW0Cc4nvY2mzV63kRS4uonpXL+mxXgK0sfmbPS cnhh90AQCLDSTIs89doDpvUDBOsjoHOI07kHPd0s9+frjGy9KXDe5Xkzfl+A32tEEJLTu6tvN+k ARRc/IijcdY/WGAMc5xq1ktvgIe5EwWB/rt6v3qSN+FS86qOh7zbOcflEIsy6wo+QfDM+R0G8tK eZ2OV7wev+5E8R9RyIA== X-Proofpoint-ORIG-GUID: 15bUN9wY1cokcuvOu3I8Hpui8VKAQE2k 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-08_04,2026-06-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 adultscore=0 phishscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 clxscore=1015 bulkscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2606080153 On 5/14/26 17:21, Shrikanth Hegde wrote: > Start with a simple steal monitor. > > It is meant to look at steal time and make the decision to > reduce/increase the preferred CPUs. > > It has > - work function to execute the steal time calculations and decision > making periodically. > - temporary cpumask, which will be used in the work function. This helps > to avoid cpumask allocation in periodic work function. > - low and high thresholds for steal time. > - sampling period to control the frequency of steal time calculations. > - cache the previous decision to avoid oscillations > > Signed-off-by: Shrikanth Hegde > --- > include/linux/sched.h | 13 +++++++++++++ > kernel/sched/core.c | 24 ++++++++++++++++++++++++ > kernel/sched/sched.h | 3 +++ > 3 files changed, 40 insertions(+) > > diff --git a/include/linux/sched.h b/include/linux/sched.h > index dcfb57c90850..ee5f19a96118 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h [...] > @@ -11351,4 +11353,26 @@ void sched_push_current_non_preferred_cpu(struct rq *rq) > push_task, this_cpu_ptr(&npc_push_task_work)); > local_irq_restore(flags); > } > + > +struct steal_monitor_t steal_mon; > + > +void sched_init_steal_monitor(void) > +{ > + INIT_WORK(&steal_mon.work, sched_steal_detection_work); > + zalloc_cpumask_var(&steal_mon.tmp_mask, GFP_KERNEL); Error handling is missing. [...]