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 43C1E1A6823 for ; Tue, 9 Jun 2026 05:54: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=1780984499; cv=none; b=RUcLXZUY7bPt+69FGCARVAFWnSKYCNxnvBix07IwWOn7QND+3t1/s8dyFgJ93szaXooR5gDKy6HgN3fBif5prJUSQNF9tc0p/VuypEIditGkrTWbXtZ5j+2Ux5XipC85O7IlmZ9l39qvfVIRu9rrUZi0UMN+1EoTEdzve1HRxjA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780984499; c=relaxed/simple; bh=+15KM9AVhK1T+9nxwuvxIPSqtkojlTtitzG2OwlbYdI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=fqtQOaiF6ICSISTbI4BYsCjBxECILdDZ4lk7eEa+I/YEbqd8o1mTx8d/HlVUhI5uWxUGwNUoKK9/oVlDG0q0gIM1T5ORydRwfUeEiv45ceBqSbDpQRC3nsotjcGXZsyxmm1NbUIJdlRl88+LLwpUmP0b+lkii5Ogni7s3EuNsUc= 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=NGyTvuOP; 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="NGyTvuOP" 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 658Kg8sZ3420508; Tue, 9 Jun 2026 05:54:33 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=EccWin XsGUDc6NsZsOdTOHQAe6R18WroSH4rP5og/B0=; b=NGyTvuOPxE6CVCX9xP1AZH h7v82DFncLm4NNYiZucirP9kOi+I8Ml5esMzUg8OX6ItORJ6XTkiozmMShhf49pQ E88C/pP1zNA/0p8UJtmZCjqOg/uv6TO5JigE4e510FjoPqX5yjLX3kDf5rO53ms4 rVGxL3YYXWYomWAlZV2wcJO4Br+pWzm3/AoYYBhpJBX5pyHJCG9rDwDLhT2bKWMw 2WKiyCEVJgpk6uJYfb16U7E0gh4ZftBLIj1+N88xjba5h5CrfSMeaoX1EsWf/w9J Q6Fnoi/U7j7mKifozIFqhDcEBNtnGaThQ/zJVq7oPjytAq379AUHT5ezCZXLlGow == 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 4em9ye2hgw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Jun 2026 05:54:32 +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 6595nafc014840; Tue, 9 Jun 2026 05:54:31 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4emxvjrkmp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Jun 2026 05:54:31 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6595sRpO23658904 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 9 Jun 2026 05:54:27 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B0F7D2004B; Tue, 9 Jun 2026 05:54:27 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3C4C920043; Tue, 9 Jun 2026 05:54:20 +0000 (GMT) Received: from [9.39.27.33] (unknown [9.39.27.33]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 9 Jun 2026 05:54:19 +0000 (GMT) Message-ID: <0203f824-cade-4226-a05e-2e5fa860a5c1@linux.ibm.com> Date: Tue, 9 Jun 2026 11:24:19 +0530 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: Ilya Leoshkevich , 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: Shrikanth Hegde In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjA5MDA1MCBTYWx0ZWRfX9ap3bhukmPNX Kj0KSuu+XeUc6DB1i99/8XwAGiwmJ+Wqp2JKNF90F11BqYKPOixwENSIaU7P6CTh/2JOnEshVRM f+A+yos8P0lOa7ejYvm+wObxK4X++X6V0XjZL60GbgwlFi2oYgzgYXe2YsWhx8Hyt+Jcc/VjAZO 5oHzxOvef27n3PNniuJXxPMFsuakvWspi9GAWYs7yaOVyDCrHqiYIakZtUCBay9rdKKWwRSt11z J1DNfoKe8QxzgpNiPJmKfRfyp+6zJpJryJyx5upXtEyMyxePOc9OeuA9AaVHGieHrpr+wksDwEc 7s9U/YPUTu+AXxEEcwvzmHHVY5JyqvHg9z+K+5SCrsYuYBG9Gh/JnmbXPyxY20NHr4sEb3OmkzR XKQ2o19e2QAusV04kCBAZZLC2PA1H4sCWlpwr7Oig5lnFhVq/LWuFuq3UXPPbx84MXllXejOhV9 VpSlVL/PvaEMHUWgWXA== X-Authority-Analysis: v=2.4 cv=QKhYgALL c=1 sm=1 tr=0 ts=6a27aa99 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=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=2_oeDvRLTb00BVYAEYMA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: yC5ele1JB1PfPXcKV-d3_YNGuVUH3_Qg X-Proofpoint-ORIG-GUID: VmNUGpa0ulNWbzDiH4LZswPeZEbtHU35 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-09_01,2026-06-09_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 impostorscore=0 suspectscore=0 spamscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2606090050 On 6/8/26 9:55 PM, Ilya Leoshkevich wrote: > > > 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. > > [...] I had seen llm complain the same. I think there very little chance for it since this is during the boot. But yes. I can add the relevant checks for tmp_mask and WARN_ON here. Its not like anything should crash if one can;t enable this steal monitor thing. PS: we don't have similar error handling in other paths for zalloc_cpumask_var case too. Many are in init time, so again very unlikely. One can add BUG_ON() for those, but that's different story.