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 8678D1D5141 for ; Fri, 9 Jan 2026 15:16:09 +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=1767971770; cv=none; b=eGKUjOy0QTGs04A0o8C3qDReGsFignaIWz9KU/2WqeLzrnCgImpEbo+Kq4NmTXG4XfLjHMFIcM8halTjOYdMWTslB5+1T0D3TmazNNGZlcTA4wW8ndkRsfmWDgRWuXaq5j/3E5clKjlgelIe/BnlFt95oAF9u0X8LwsjhGeRgXE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767971770; c=relaxed/simple; bh=hoXVjogn6uaNI3WkEGm22jDwrRu43LdPeHReFQwRFW8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=luijewgncul/JpTzhKk0KeV7JCPWlC9POZL2EG7bQlvc7yES9mHWqRUNI9DsHUEEVuoEc45kwetSVwGt8XQn18FcPHfH8CLjUnJ9gfK1CMPMaXkNkAvIHQ6s7rzKIGe29vZisgoEHPURUxMOJTaFOz4RsHP4lSW5amQ7qgIU9Fg= 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=GqJIdfjQ; 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="GqJIdfjQ" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 609C11GH000759; Fri, 9 Jan 2026 15:15:55 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=xUZfxX NNK/aZ5zmY91jALyNiZaGWM3J1n9XwwS/xhc8=; b=GqJIdfjQWbXf3gw6gq4LJ7 iKK5UmfUk3+eW9EHiUmRyp/2gsq975EfzBw7CWlTCutj1jY/lo3jsZeVlLSEo6LI XobwgR/Sns+bfg89IPgFP74FeaG7SoL0Vd+c0MS1vfEJ/xFjSjc7I/AWHojDuqDP KFldKpsxCr73YEGRln/8jw80R6bAdrWV75Shz8GkLxHdDg2pT8yCU5nx2AP/9TjU q1ciGKn7iRm2XrKuUEY/0cj3jPB6CLrwua4WUPZfcbnh/8NihZ3GiGHd3Qqo3dkQ dmjTltFZ2cdH+qoJ5S0E+mDBEqR6M3sMDkdWIGhBs7/O3y1DtiFF4chrA8kR4POg == Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4betru2bwm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Jan 2026 15:15:55 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 609ESO59019154; Fri, 9 Jan 2026 15:15:54 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4bfg51n7a7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Jan 2026 15:15:54 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 609FFqOi44302602 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Jan 2026 15:15:52 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 66B0D20043; Fri, 9 Jan 2026 15:15:52 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D0C0220040; Fri, 9 Jan 2026 15:15:49 +0000 (GMT) Received: from [9.39.17.37] (unknown [9.39.17.37]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 9 Jan 2026 15:15:49 +0000 (GMT) Message-ID: Date: Fri, 9 Jan 2026 20:45:48 +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 3/3] sched/fair: Remove nohz.nr_cpus and use weight of cpumask instead To: Valentin Schneider Cc: kprateek.nayak@amd.com, juri.lelli@redhat.com, tglx@linutronix.de, dietmar.eggemann@arm.com, anna-maria@linutronix.de, frederic@kernel.org, wangyang.guo@intel.com, mingo@kernel.org, peterz@infradead.org, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org References: <20260107065125.669668-1-sshegde@linux.ibm.com> <20260107065125.669668-4-sshegde@linux.ibm.com> From: Shrikanth Hegde Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=aaJsXBot c=1 sm=1 tr=0 ts=69611bab cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=pGLkceISAAAA:8 a=VnNF1IyMAAAA:8 a=i6NzWNpG3uXQe82OAwwA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: h2KhsPJT4E1l9O-z7MPIYU-0E5yPQN4C X-Proofpoint-ORIG-GUID: h2KhsPJT4E1l9O-z7MPIYU-0E5yPQN4C X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTA5MDExMCBTYWx0ZWRfX91ow2GFYnoKP Pwa/cm6cOoUCbrKxboYUZxucDswdTq3YKTgC20mMJqmb+6XSc9xsd7qccmEDu6bKkg0VJKKZ8pq Qhxo1MOSkqPAZ+ohEm31qUdKdqJCHllPqP+mziRiS5d4rdpvvVCbl6WLi4OaJfYKUCR+XsryvfQ qRztJEEJGIt7lvqkKov2XfJ/yDGAEvxgwx/dFJYUg8Y6FIFlLXideSj1WJHSMECUQtXrRudJSpy 8BG448GTS+fUJQ7yMVTEAECTx8uHqWzP1lbUwGp0iorrlJHt8MUVpktGsSlZDF9WEM32K3hVZLb JShwfcb/NOr/dfNheTTD0sEAt18fAqYVfzQoTgtCvTB2zA3+RL/DHViOb7D8Q8ume0BdtPNy21j vuTe+ga4P1BPvUKnLPma8KiVRJSI7XpgClzvthTJVdHYNT7u+3Ax5hVltU52+ad7FWQ+INIoCY0 FS6LIUl3zOkxC/ljLGQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2026-01-09_04,2026-01-08_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 phishscore=0 spamscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2512120000 definitions=main-2601090110 Hi Valentin. Thanks for going through. On 1/9/26 8:14 PM, Valentin Schneider wrote: > On 07/01/26 12:21, Shrikanth Hegde wrote: >> nohz.nr_cpus was observed as contended cacheline when running >> enterprise workload on large systems. >> >> Fundamental scalability challenge with nohz.idle_cpus_mask >> and nohz.nr_cpus is the following: >> >> (1) nohz_balancer_kick() observes (reads) nohz.nr_cpus >> (or nohz.idle_cpu_mask) and nohz.has_blocked to see whether there's >> any nohz balancing work to do, in every scheduler tick. >> >> (2) nohz_balance_enter_idle() and nohz_balance_exit_idle() >> (through nohz_balancer_kick() via sched_tick()) modify (write) >> nohz.nr_cpus (and/or nohz.idle_cpu_mask) and nohz.has_blocked. >> > > My first reaction on reading the whole changelog was: "but .nr_cpus and > .idle_cpus_mask are in the same cacheline?!", which as Ingo pointed out > somewhere down [1] isn't true for CPUMASK_OFFSTACK, so this change > effectively gets rid of the dirtying of one extra cacheline during idle > entry/exit. > > [1]: http://lore.kernel.org/r/aS3za7X9BLS5rg65@gmail.com > > I'd suggest adding something like so in this part of the changelog: > > """ > Note that nohz.idle_cpus_mask and nohz.nr_cpus reside in the same > cacheline, however under CONFIG_CPUMASK_OFFSTACK the backing storage for > nohz.idle_cpus_mask will be elsewhere. This implies two separate cachelines > being dirtied upon idle entry / exit. > """ > ok. Will do that. Thanks. Even for CONFIG_CPUMASK_OFFSTACK=n, usual configuration is like 512/1024/ 2048 or higher. For 64 byte cacheline, 1 cacheline can hold 512 CPUs. So idle_cpus_mask and rest of nohz fields including nr_cpus will be in different cacheline. Even for powerpc(128 byte cacheline), where CONFIG_CPUMASK_OFFSTACK=n, default is NR_CPUS=2048. that means idle_cpus_mask will take 2 cachelines and rest of nohz fields will be in third cacheline. So in most of the cases, this implies dirtying one less cacheline. data points with CONFIG_CPUMASK_OFFSTACK=y/n [1]: https://lore.kernel.org/all/fdb378e7-7797-4aeb-a79f-12af4cb1b81a@linux.ibm.com/