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 949CA2F2618 for ; Tue, 2 Dec 2025 20:27:16 +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=1764707238; cv=none; b=ruUQLvb4ya99H1N3JW40WFTkGrNTpJ3biZ2YC9KJI42Hq6+RmbUbbN3+6htGer+dW24egrwaQWZk7RG5Q1qgx1mBxtGgIRkbQkgri2RcAkCFL0klNpkcyAQO6JWIwElDURkK1LKWWu0CCmL8AecsbyhiS6ijksW2Y9thwIXFpfY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764707238; c=relaxed/simple; bh=n+o4xE9F0GW5CNZWH0KtvWzU1Ryyw3xhRICQqgwHRQg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=VbHspJYObAWdsXy5XkhyLk8kh49QoQvFqoV6WuSsN35I56PQDMnkgsM3yskUZ7vwLpYPpyzNllcKl2bFtA32vPe0xtRwnc7TLe2rFMX8+E9jNv7C+z3uXPmVeffl2FXru7XbQ0zOzB+xG/h66L3diB9eysUrBJOESI03Sg9gFik= 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=bggpvoBN; 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="bggpvoBN" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5B2J0Tc4014613; Tue, 2 Dec 2025 20:26:14 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=qMWTOK 2874nhq7PKJCAFeWwAnXwtlHD+7My4VUJR0qU=; b=bggpvoBNKcvjkPeH2gx611 UoiyJcDVqznIn4cJ3Wyy6Uz0oULS/lAjAEg3yoDL3xk6EkNjVF1i5Wv3TnXMgnoQ c6JL077NOlpgcg7pn8So+4f+w/2LjJMtu6/SERiyo0RxtcurFQbTNX4N8c4h80vq 23TqTRXtYWMvVrKBUGGPSSF/eHeSJ5fL57qubHFePs/IoGvAhL18s0UmCNYWLaof BTdoV8+krI+HGXWJRk4/JZWwduLDh94bB/RcyjHB+2foGmQ0+eoSNY6ocC7culdH 5sPoe67BZxtvB3BNh6JWhca3ontsTbUdh2mu71afQbautm8bV7c0QBDTbmif8FQA == 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 4aqrj9q5q1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Dec 2025 20:26:14 +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 5B2HqSCx029328; Tue, 2 Dec 2025 20:26:13 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4ardv1e8kp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Dec 2025 20:26:13 +0000 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 5B2KQB7e30212352 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 2 Dec 2025 20:26:11 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6EF6E20043; Tue, 2 Dec 2025 20:26:11 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 35BA620040; Tue, 2 Dec 2025 20:26:09 +0000 (GMT) Received: from [9.124.221.89] (unknown [9.124.221.89]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 2 Dec 2025 20:26:08 +0000 (GMT) Message-ID: Date: Wed, 3 Dec 2025 01:56:08 +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 1/1 -v3] sched/fair: Sort out 'blocked_load*' namespace noise To: Ingo Molnar , Vincent Guittot Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Frederic Weisbecker , Juri Lelli , Dietmar Eggemann , Valentin Schneider , Linus Torvalds , Mel Gorman , Steven Rostedt , Thomas Gleixner References: <20251202081304.3103393-1-mingo@kernel.org> 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-Proofpoint-GUID: C4-vts8qUL9ot5q0iqZmNV4vZG3wVZxU X-Proofpoint-ORIG-GUID: C4-vts8qUL9ot5q0iqZmNV4vZG3wVZxU X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTI5MDAyMCBTYWx0ZWRfX+FmC3y9mP5oX 4DT5pePxWRn/2noDCegrRFciTmSlyNbdIQQyn9X9FOTw1FS5LPajK+mMAOjB/Mp1aK0fwbZnxud BsdMPctDwVc0Y6q4KLCwGWhRGofFaBIJ7DMp4ewO8rKQ5o50o6dxerj+jLMg0C3nX9gjcp2QqiH 76Msj3XyKMz+2lvU0+vkVRUNgfJcqNuAOahXfva9RCrQif8nevGlntrOTUNduOVpH8P4Z4t0Jak UBYedzSo+ZbUdNLy1NdJvFlMkgkXA+7BnQF5bQ/ysO8ZpVsrgogjbL2Vg2ASbZl6r42JmAjeA/H EFmRz29GYKOnmJx27XXZQZLCShuChSfVWZsJKwtLDa5pwaDPYjOsHHoFtUazZqXvm0a5/p4md7v RBMjy+1lE4f5urDi64nykY+kLFbhbA== X-Authority-Analysis: v=2.4 cv=dYGNHHXe c=1 sm=1 tr=0 ts=692f4b66 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=bC-a23v3AAAA:8 a=pGLkceISAAAA:8 a=VwQbUJbxAAAA:8 a=KKAkSRfTAAAA:8 a=JfrnYn6hAAAA:8 a=VnNF1IyMAAAA:8 a=m8z-NVSjrP0AuW8ovsAA:9 a=QEXdDO2ut3YA:10 a=FO4_E8m0qiDe52t0p3_H:22 a=cvBusfyB2V15izCimMoJ:22 a=1CNFftbPRP8L7MoqJWF3:22 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=2025-12-01_01,2025-11-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 suspectscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 priorityscore=1501 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510240000 definitions=main-2511290020 > From 395fc683e48f6fe5f36082691681d0d64d1a48ff Mon Sep 17 00:00:00 2001 > From: Ingo Molnar > Date: Tue, 2 Dec 2025 10:35:06 +0100 > Subject: [PATCH] sched/fair: Sort out 'blocked_load*' namespace noise > > There's three layers of logic in the scheduler that > deal with 'has_blocked' (load) handling of the NOHZ code: > > (1) nohz.has_blocked, > (2) rq->has_blocked_load, deal with NOHZ idle balancing, > (3) and cfs_rq_has_blocked(), which is part of the layer > that is passing the SMP load-balancing signal to the > NOHZ layers. > > The 'has_blocked' and 'has_blocked_load' names are used > in a mixed fashion, sometimes within the same function. > > Standardize on 'has_blocked_load' to make it all easy > to read and easy to grep. > > No change in functionality. > Nothing to do with this patch, but for my understanding. rq->has_blocked_load - is reset when there is no cfs,rt,dl or irq or hw_pressure. That meant this CPU is idle for sometime right? Then just before disabling the tick, it is set to 1 again in nohz_balance_enter_idle. at that point also it won't have anything on its rq right? it would set nohz.has_blocked_load and that could trigger a NOHZ_STATS_KICK. That doesn't do any balancing per se. It would update the same rq->has_blocked_load=0 again. When it wakes up after sometime, i don't see rq->has_blocked_load updated. So it would continue to be 0 until it hits nohz_balance_enter_idle? > Suggested-by: Vincent Guittot > Signed-off-by: Ingo Molnar > Reviewed-by: Vincent Guittot > Cc: Peter Zijlstra > Cc: Frederic Weisbecker > Cc: Shrikanth Hegde > Link: https://patch.msgid.link/aS6yvxyc3JfMxxQW@gmail.com > --- > kernel/sched/fair.c | 40 ++++++++++++++++++++-------------------- > 1 file changed, 20 insertions(+), 20 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index b6043ec4885b..76f5e4b78b30 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -7140,7 +7140,7 @@ static DEFINE_PER_CPU(cpumask_var_t, should_we_balance_tmpmask); > static struct { > cpumask_var_t idle_cpus_mask; > atomic_t nr_cpus; > - int has_blocked; /* Idle CPUS has blocked load */ > + int has_blocked_load; /* Idle CPUS has blocked load */ > int needs_update; /* Newly idle CPUs need their next_balance collated */ > unsigned long next_balance; /* in jiffy units */ > unsigned long next_blocked; /* Next update of blocked load in jiffies */ > @@ -9776,7 +9776,7 @@ static void attach_tasks(struct lb_env *env) > } > > #ifdef CONFIG_NO_HZ_COMMON > -static inline bool cfs_rq_has_blocked(struct cfs_rq *cfs_rq) > +static inline bool cfs_rq_has_blocked_load(struct cfs_rq *cfs_rq) > { > if (cfs_rq->avg.load_avg) > return true; > @@ -9809,16 +9809,16 @@ static inline void update_blocked_load_tick(struct rq *rq) > WRITE_ONCE(rq->last_blocked_load_update_tick, jiffies); > } > > -static inline void update_blocked_load_status(struct rq *rq, bool has_blocked) > +static inline void update_has_blocked_load_status(struct rq *rq, bool has_blocked_load) > { > - if (!has_blocked) > + if (!has_blocked_load) > rq->has_blocked_load = 0; > } > #else /* !CONFIG_NO_HZ_COMMON: */ > -static inline bool cfs_rq_has_blocked(struct cfs_rq *cfs_rq) { return false; } > +static inline bool cfs_rq_has_blocked_load(struct cfs_rq *cfs_rq) { return false; } > static inline bool others_have_blocked(struct rq *rq) { return false; } > static inline void update_blocked_load_tick(struct rq *rq) {} > -static inline void update_blocked_load_status(struct rq *rq, bool has_blocked) {} > +static inline void update_has_blocked_load_status(struct rq *rq, bool has_blocked_load) {} > #endif /* !CONFIG_NO_HZ_COMMON */ > > static bool __update_blocked_others(struct rq *rq, bool *done) > @@ -9875,7 +9875,7 @@ static bool __update_blocked_fair(struct rq *rq, bool *done) > list_del_leaf_cfs_rq(cfs_rq); > > /* Don't need periodic decay once load/util_avg are null */ > - if (cfs_rq_has_blocked(cfs_rq)) > + if (cfs_rq_has_blocked_load(cfs_rq)) > *done = false; > } > > @@ -9935,7 +9935,7 @@ static bool __update_blocked_fair(struct rq *rq, bool *done) > bool decayed; > > decayed = update_cfs_rq_load_avg(cfs_rq_clock_pelt(cfs_rq), cfs_rq); > - if (cfs_rq_has_blocked(cfs_rq)) > + if (cfs_rq_has_blocked_load(cfs_rq)) > *done = false; > > return decayed; > @@ -9956,7 +9956,7 @@ static void __sched_balance_update_blocked_averages(struct rq *rq) > decayed |= __update_blocked_others(rq, &done); > decayed |= __update_blocked_fair(rq, &done); > > - update_blocked_load_status(rq, !done); > + update_has_blocked_load_status(rq, !done); > if (decayed) > cpufreq_update_util(rq, 0); > } > @@ -12452,7 +12452,7 @@ static void nohz_balancer_kick(struct rq *rq) > if (likely(!atomic_read(&nohz.nr_cpus))) > return; > > - if (READ_ONCE(nohz.has_blocked) && > + if (READ_ONCE(nohz.has_blocked_load) && > time_after(now, READ_ONCE(nohz.next_blocked))) > flags = NOHZ_STATS_KICK; > > @@ -12613,9 +12613,9 @@ void nohz_balance_enter_idle(int cpu) > > /* > * The tick is still stopped but load could have been added in the > - * meantime. We set the nohz.has_blocked flag to trig a check of the > + * meantime. We set the nohz.has_blocked_load flag to trig a check of the > * *_avg. The CPU is already part of nohz.idle_cpus_mask so the clear > - * of nohz.has_blocked can only happen after checking the new load > + * of nohz.has_blocked_load can only happen after checking the new load > */ > if (rq->nohz_tick_stopped) > goto out; > @@ -12631,7 +12631,7 @@ void nohz_balance_enter_idle(int cpu) > > /* > * Ensures that if nohz_idle_balance() fails to observe our > - * @idle_cpus_mask store, it must observe the @has_blocked > + * @idle_cpus_mask store, it must observe the @has_blocked_load > * and @needs_update stores. > */ > smp_mb__after_atomic(); > @@ -12644,7 +12644,7 @@ void nohz_balance_enter_idle(int cpu) > * Each time a cpu enter idle, we assume that it has blocked load and > * enable the periodic update of the load of idle CPUs > */ > - WRITE_ONCE(nohz.has_blocked, 1); > + WRITE_ONCE(nohz.has_blocked_load, 1); > } > > static bool update_nohz_stats(struct rq *rq) > @@ -12685,8 +12685,8 @@ static void _nohz_idle_balance(struct rq *this_rq, unsigned int flags) > > /* > * We assume there will be no idle load after this update and clear > - * the has_blocked flag. If a cpu enters idle in the mean time, it will > - * set the has_blocked flag and trigger another update of idle load. > + * the has_blocked_load flag. If a cpu enters idle in the mean time, it will > + * set the has_blocked_load flag and trigger another update of idle load. > * Because a cpu that becomes idle, is added to idle_cpus_mask before > * setting the flag, we are sure to not clear the state and not > * check the load of an idle cpu. > @@ -12694,12 +12694,12 @@ static void _nohz_idle_balance(struct rq *this_rq, unsigned int flags) > * Same applies to idle_cpus_mask vs needs_update. > */ > if (flags & NOHZ_STATS_KICK) > - WRITE_ONCE(nohz.has_blocked, 0); > + WRITE_ONCE(nohz.has_blocked_load, 0); > if (flags & NOHZ_NEXT_KICK) > WRITE_ONCE(nohz.needs_update, 0); > > /* > - * Ensures that if we miss the CPU, we must see the has_blocked > + * Ensures that if we miss the CPU, we must see the has_blocked_load > * store from nohz_balance_enter_idle(). > */ > smp_mb(); > @@ -12766,7 +12766,7 @@ static void _nohz_idle_balance(struct rq *this_rq, unsigned int flags) > abort: > /* There is still blocked load, enable periodic update */ > if (has_blocked_load) > - WRITE_ONCE(nohz.has_blocked, 1); > + WRITE_ONCE(nohz.has_blocked_load, 1); > } > > /* > @@ -12828,7 +12828,7 @@ static void nohz_newidle_balance(struct rq *this_rq) > return; > > /* Don't need to update blocked load of idle CPUs*/ > - if (!READ_ONCE(nohz.has_blocked) || > + if (!READ_ONCE(nohz.has_blocked_load) || > time_before(jiffies, READ_ONCE(nohz.next_blocked))) > return; >