From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 2C786235358 for ; Fri, 14 Nov 2025 09:49:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763113756; cv=none; b=jdTSd6dbJna1lTDFO3zCZkOyOAHbOHdVeU/xz0jiwJyabX1O9ERkqsHTG9cyf3B6CIg4CND+/EugZqeBVQK12cd75gNav7ogjomdHi8PDqD0Xjj2Z8QpccJpcsfHECBQqJx8pvzXAE4UwFqKS/VoKMnAYrxA6E1PQOagqP1qZyA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763113756; c=relaxed/simple; bh=sanw6vLw6I+qtRBUe0Sq+XqPRy2q0bXIzXXBnW+Kylg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qvfb7UdNkNjZ57cpHzvGUUaSVhc/D5PJZsRUHuOnjP86fA6x8ty60aLzqyc//og+GCh8eeOIxZ53IxmiSXU+jgqlDmPjfexpCzVVEV2NmEgSHse2r+z7XrF52zrlfd6nr+Ae7nHGAaur3eGJdBPdSIvKanakxy6SabgpcIp4JI4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=es2U+Drj; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="es2U+Drj" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=xnnq9GHL54Xq6AdxJb6cIUKRmX3YVGhL8iw07GUqeu8=; b=es2U+Drjc5zgXT3VISHhHk8q9t Hx+2EUEkQHcb1l701NfS9KLrdXjmoC5rlPC6mvxMUJ06ASrIRGF66oHGcbznM1zx3rPXQqQNIrCO9 pIYjn4csaKoK4ORWZLlWFMqrzfQCGm+uCmFuGjBTHdffVGa4GWRKcLSOtlvPZiTErWy/Zk4NzzWQB L/0ukGs2JqMBFkCKk2ImSuIZ2e+UnDM5L0M3QE2BOtLi7FC2MgiEIyPmJW7wQwDcB8r/Y4fs2t1Df 1ehjQ+rUhbdnplj/Pw5GzqCzM9ZrbuquwlzVBcEa43sWBwiArMfXAudOtr3eggwdWAQ7lQjfN+LVM fi0tDJKQ==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vJqQQ-000000094GQ-0aXg; Fri, 14 Nov 2025 09:49:02 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id A5C9230023C; Fri, 14 Nov 2025 10:49:01 +0100 (CET) Date: Fri, 14 Nov 2025 10:49:01 +0100 From: Peter Zijlstra To: Shrikanth Hegde Cc: vincent.guittot@linaro.org, mingo@redhat.com, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, linux-kernel@vger.kernel.org, Chris Mason , Joseph Salisbury , Adam Li , Hazem Mohamed Abuelfotoh , Josh Don Subject: Re: [PATCH 2/4] sched/fair: Small cleanup to sched_balance_newidle() Message-ID: <20251114094901.GH3245006@noisy.programming.kicks-ass.net> References: <20251107160645.929564468@infradead.org> <20251107161739.525916173@infradead.org> <2acd7c1d-e2b4-40a0-85de-55f9b2635dad@linux.ibm.com> <20251112144241.GP278048@noisy.programming.kicks-ass.net> <20251112150818.GG4068168@noisy.programming.kicks-ass.net> <01dcb63e-9ebd-42ca-9418-a822bf081bfc@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01dcb63e-9ebd-42ca-9418-a822bf081bfc@linux.ibm.com> On Wed, Nov 12, 2025 at 08:58:23PM +0530, Shrikanth Hegde wrote: > > @@ -12865,6 +12869,8 @@ static int sched_balance_newidle(struct > > if (!cpu_active(this_cpu)) > > return 0; > > + __sched_balance_update_blocked_averages(this_rq); > > + > > is this done only when sd == null ? Its done always. > > /* > > * This is OK, because current is on_cpu, which avoids it being picked > > * for load-balance and preemption/IRQs are still disabled avoiding > > @@ -12891,7 +12897,6 @@ static int sched_balance_newidle(struct > > raw_spin_rq_unlock(this_rq); > > t0 = sched_clock_cpu(this_cpu); > > - sched_balance_update_blocked_averages(this_cpu); > > rcu_read_lock(); > > for_each_domain(this_cpu, sd) { > > Referring to commit, > 9d783c8dd112a (sched/fair: Skip update_blocked_averages if we are defering load balance) > I think vincent added the max_newidle_lb_cost check since sched_balance_update_blocked_averages is costly. That seems to suggest we only should do sched_balance_update_blocked_averages() when we're going to do balancing and so skipping when !sd is fine.