From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 446E2430B99 for ; Sun, 1 Mar 2026 19:30:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772393444; cv=none; b=cl3l5uBhgiX4T/4OldLWUf8KSuG0VQNbGgQYg1W9UC4rkIX9+gzptHg+5QKvV1iK7IvOB1S6YbKJ06N43wh1FdPKfDZhomq7neUn0aE4pbE0RIJ3wcVfkXLrv3eWZXVXmtKENbGYofTL8K/q8+l3N4TBvmvNgD5JdOHQu42Pax8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772393444; c=relaxed/simple; bh=k5hQJ+5E0+M9KB5wOXm5VNepM47KRddXMgIpwOZm0o8=; h=Date:Message-ID:From:To:Cc:Subject; b=pJ7osvrlDwFh9M89QWHTVpiw5lwS/c7IBoWM4YcE0bzHM1i+oUAuXMZaHpnOGDG/NS+E5Y8FXaY2R5MtfymE8WnASrvIKvS1IzrLtQw4RY3hnh9OlVQxV2/lrvBui5KFayPOLNMEqnhEmz1Fu/GDvhWdn1ZeBX3a4WbrLls91WY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DgQOjife; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DgQOjife" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AFF0C116C6; Sun, 1 Mar 2026 19:30:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772393443; bh=k5hQJ+5E0+M9KB5wOXm5VNepM47KRddXMgIpwOZm0o8=; h=Date:From:To:Cc:Subject:From; b=DgQOjifebgDkU6tdMYqzAPnFHgLrCqD8t9P38V/ZgJT4Ns/R10S+mqhRpzofWzlvR obRLF8CE0RztbxyHo6fUrdol2tSqS1jxbCgfILgyy51XyWKCgGBocIBaeKUKqHWxaz wdefoPKjIjsd7PR/12hCr491TKgFbjovIlGzalEJi364MoGFFLAk6ob0CoB+YfzXks kd9DoUYPGLXpa4tfHPx3yK0/DJ/u+jbdxfk0K+l+FO408nPjFSdCzz2J7wuhVqT+f/ yjDDbr3r7D4EwiHjc/mdmuPVfoOkL/FItNJ6TBmf1FIBK+xXVV91+AkYRS/a8OZdly EdYd2W5S6qJVw== Date: Sun, 01 Mar 2026 20:30:39 +0100 Message-ID: <20260301191959.406218221@kernel.org> User-Agent: quilt/0.68 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , "Rafael J. Wysocki" , Frederic Weisbecker , Christian Loehle Subject: [patch 0/2] sched/idle: Prevent pointless NOHZ transitions in default_idle_call() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: default_idle_call() is used when cpuidle is not available. That's the case on most virtual machines. It unconditionally tries to transition to NOHZ idle mode on every invocation, which allows the hypervisor to go into long idle sleeps. But that's counterproductive on a loaded system where CPUs go briefly idle for a couple of microseconds. That causes to reprogram the clock event device twice, one on entry and then when leaving idle a few microseconds later. That's especially hurtful for VMs as programming the clock event device implies a VM exit. See also the related discussion here: https://lore.kernel.org/875x7mv8wd.ffs@tglx Cure this by implementing a moving average tracking idle time in default_idle_call() and only stop the tick when the resulting average idle time is larger than a tick. The series applies on v7.0-rc1. Thanks, tglx --- include/linux/cpuidle.h | 1 kernel/sched/idle.c | 65 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 57 insertions(+), 9 deletions(-)