From nobody Wed Oct 8 18:13:32 2025 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 4DD3A15278E for ; Wed, 25 Jun 2025 19:12:13 +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=1750878734; cv=none; b=keLWGmQHdTG+qrf+Di4WrU8t3ZWV3yDTaNH5qQyFLSyviOvbReMkUSpD6TpIwgSGifxQdqmCIf8Oi8ueJuZEsJu/uTv/DsUVldSScb57NnZ2ddBglmfeOAUEMJJIj6Qp5uhH2uOcrtOttvOqMZnzLH1D7ykmuTnHWXh3hYOEhhU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750878734; c=relaxed/simple; bh=tZyUEuiAwjOWn4l54EMjA9B9fEncfvOXEEG4o6WjRu4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BT5KvGoegCfUytrcb5i/f33RIdMXjzmpfQgw5jsYVM/s2MJfhkF8jXWoc3Qm3kbqB/KkeXxnc76235iPWLtS/igfaafS7OUGteMWRA1pYyBiroE7bgwnx4q1K4iMMl8XxDafOl+9OIaaRt73OzLSywiavGdHVpo6ZJdSZnZk/+A= 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=I7j9hsKP; 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="I7j9hsKP" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55PELbb5002256; Wed, 25 Jun 2025 19:11:38 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=9+d7RfDCUMcyGi2BX CxRuU2xnlzRa42/iauZPwBkcyU=; b=I7j9hsKPuyh2e3he1wR8KmwFe8lQA7f5y rYxKu41fp/sfEjIwX4rW2yhSBAAcPLDI9kiKSWp1qzhf8EfM2exY4YvhmxBtEklF N4gcfYpqek8GdSi4kZHoshnLzrYdvrwMh7ieFPjuhIb1Bg9TpfiQIjGFYPTYd5iK D26gfc5tUip1KNh8VP8MHqnNN1MoFiASX8LCe0cEhUG3vcVnNI7jv5so1hD2qaNf eh7V6RheSlq9H/suTEHOMNSC/o642v3fev3/JyxHfU5QBdwkwE3Qii+uMMkkQvd7 wP7ZygwJ/KHl7znanktJ40JYDvyfGrdfA4b2ZvsIS1wLAf6F3DFSA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 47dm8jhhd1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Jun 2025 19:11:38 +0000 (GMT) Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 55PJAD2u020289; Wed, 25 Jun 2025 19:11:37 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 47dm8jhhcw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Jun 2025 19:11:37 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 55PGq7wY030487; Wed, 25 Jun 2025 19:11:36 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 47e7f030rd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Jun 2025 19:11:36 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 55PJBWGM52494642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jun 2025 19:11:32 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 105EC20040; Wed, 25 Jun 2025 19:11:32 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6F22720043; Wed, 25 Jun 2025 19:11:28 +0000 (GMT) Received: from li-7bb28a4c-2dab-11b2-a85c-887b5c60d769.ibm.com.com (unknown [9.124.209.143]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 25 Jun 2025 19:11:28 +0000 (GMT) From: Shrikanth Hegde To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, tglx@linutronix.de, yury.norov@gmail.com, maddy@linux.ibm.com Cc: sshegde@linux.ibm.com, vschneid@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, kprateek.nayak@amd.com, huschle@linux.ibm.com, srikar@linux.ibm.com, linux-kernel@vger.kernel.org, christophe.leroy@csgroup.eu, linuxppc-dev@lists.ozlabs.org, gregkh@linuxfoundation.org Subject: [RFC v2 1/9] sched/docs: Document avoid_cpu_mask and avoid CPU concept Date: Thu, 26 Jun 2025 00:41:00 +0530 Message-ID: <20250625191108.1646208-2-sshegde@linux.ibm.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250625191108.1646208-1-sshegde@linux.ibm.com> References: <20250625191108.1646208-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: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjI1MDE0MSBTYWx0ZWRfX57VmWe5XYxRc b58FKiEEVnlkADF1Y4ms1gpjAq+hnNW/yN+Xh/0hAwGZ21ac7AJbrQdynjCCmVuDviQ2p12GRYo s8uIxGSTratWHXmzKrMwzSOIZXkr8DWyMcSZ/c9bqS1DHIrmsyF38BlAsBAf4qDQzZm59XH4Ewg nc3l4orWLycmkkV1j0/YqhYqVN/tOMxSSy9iFJrzN+SC+AGDAfQbauX/JX3F6FTMICo/Hd5hb3u xItrAyJh3uTSKLFOE7sFP5GjjyzhKZiqfOY4odzWqihMT8vD0gvJ7wjRLmyqoem0z3GarbmoMRN Z5BVmObk0zAhpK7wfqVbZAYPbDE9IrpG6b6qpaYyn+x3tMqS9pdcaMTLL2CAtyuTUMVO5lxLeZ1 M+VkhqQWR5O8vHeChKt8BsY5D8M9rao9cMCejpXDLt6GV0vmaoQj7W/Z/erZmxKhwbCp+fzz X-Proofpoint-GUID: CrdOf7y_8SXN7UNmObo2YZTj5GjREvzS X-Proofpoint-ORIG-GUID: wQj-IDrmhnmGmzaEQsz7vdRhdF1uncyG X-Authority-Analysis: v=2.4 cv=combk04i c=1 sm=1 tr=0 ts=685c49ea cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=6IFa9wvqVegA:10 a=VnNF1IyMAAAA:8 a=5nzgSDI2G5BSHnRbDcAA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-06-25_06,2025-06-25_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 spamscore=0 adultscore=0 mlxlogscore=977 clxscore=1015 impostorscore=0 suspectscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2506250141 Content-Type: text/plain; charset="utf-8" This describes what avoid CPU means and what scheduler aims to do=20 when a CPU is marked as avoid.=20 Signed-off-by: Shrikanth Hegde --- Documentation/scheduler/sched-arch.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Documentation/scheduler/sched-arch.rst b/Documentation/schedul= er/sched-arch.rst index ed07efea7d02..d32755298fca 100644 --- a/Documentation/scheduler/sched-arch.rst +++ b/Documentation/scheduler/sched-arch.rst @@ -62,6 +62,31 @@ Your cpu_idle routines need to obey the following rules: arch/x86/kernel/process.c has examples of both polling and sleeping idle functions. =20 +CPU Avoid +=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Under paravirt conditions it is possible to overcommit CPU resources. +i.e sum of virtual CPU(vCPU) of all VM is greater than number of physical +CPUs(pCPU). Under such conditions when all or many VM have high utilizatio= n, +hypervisor won't be able to satisfy the requirement and has to context swi= tch +within or across VM. VM level context switch is more expensive compared to +task context switch within the VM. + +In such cases it is better that VM's co-ordinate among themselves and ask = for +less CPU request by not using some of the vCPUs. Such vCPUs where workload +can be avoided at the moment are called as "Avoid CPUs". Note that when the +pCPU contention goes away, these vCPUs can be used again by the workload. + +Arch need to set/unset the vCPU as avoid in cpu_avoid_mask. When set, avoid +the CPU and when unset, use it as usual. + +Scheduler will try to avoid those CPUs as much as it can. +This is achived by +1. Not selecting those CPU at wakeup. +2. Push the task away from avoid CPU at tick. +3. Not selecting avoid CPU at load balance. + +This works only for SCHED_RT and SCHED_NORMAL. =20 Possible arch/ problems =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --=20 2.43.0