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 CC3E476C7E; Mon, 29 Jan 2024 17:17:34 +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=1706548654; cv=none; b=QKMEqFTgR9U2EgCHxmv/omOB8/Gj791mNFfh4NsNSbUOH+We1rYvo4vyL8A2idU8VMqfGXkG/HyBJ/i41Iasemu+O8he23EAKRADQGw5MCzOXmpf8um/ZgWTcppfs85WtNh4AgpNwMRBgb4nlBugs8M7xcaCsJSNMLtmhmBEDYc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706548654; c=relaxed/simple; bh=YHL4/BOk7t045mpUl08uJD3hj4+hUJqLPi0QjIWAn1g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mqe5S55yTAQgs/uTW3REdvNJmXejqxmOVLNqsBcFb0HcsGJGa1KvCCkmsWQsUSSLA46EC6Xj6pWAKICWn6esvNcFJGrdtcB0Xat8N5q2ZK4VmjXrXcGXVn0wjfj4NvnsOmUIEu7O/N2EyAqj1pRHNBnRpxZ5S7AVefB+QIBbZCo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nBvkAqJ6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nBvkAqJ6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92DC5C433C7; Mon, 29 Jan 2024 17:17:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1706548654; bh=YHL4/BOk7t045mpUl08uJD3hj4+hUJqLPi0QjIWAn1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nBvkAqJ6cvovxCPx9jvkvLygY5zKyNUIgrfuMMJAhEqGeAsGSZCVrNQ9PzWyznNTf jcCKFc/5Af8YuVXoVYBJ5a24kRGQZAqMIA9E7IayDD8FimGEso2rX1908EnwGj2TgQ VfRZ2TegcuDarJqKc6oO8arimAtZuQhWosFXn86s= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tim Chen , Thomas Gleixner Subject: [PATCH 6.6 328/331] tick/sched: Preserve number of idle sleeps across CPU hotplug events Date: Mon, 29 Jan 2024 09:06:32 -0800 Message-ID: <20240129170024.484471638@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129170014.969142961@linuxfoundation.org> References: <20240129170014.969142961@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tim Chen commit 9a574ea9069be30b835a3da772c039993c43369b upstream. Commit 71fee48f ("tick-sched: Fix idle and iowait sleeptime accounting vs CPU hotplug") preserved total idle sleep time and iowait sleeptime across CPU hotplug events. Similar reasoning applies to the number of idle calls and idle sleeps to get the proper average of sleep time per idle invocation. Preserve those fields too. Fixes: 71fee48f ("tick-sched: Fix idle and iowait sleeptime accounting vs CPU hotplug") Signed-off-by: Tim Chen Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240122233534.3094238-1-tim.c.chen@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- kernel/time/tick-sched.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -1548,6 +1548,7 @@ void tick_cancel_sched_timer(int cpu) { struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu); ktime_t idle_sleeptime, iowait_sleeptime; + unsigned long idle_calls, idle_sleeps; # ifdef CONFIG_HIGH_RES_TIMERS if (ts->sched_timer.base) @@ -1556,9 +1557,13 @@ void tick_cancel_sched_timer(int cpu) idle_sleeptime = ts->idle_sleeptime; iowait_sleeptime = ts->iowait_sleeptime; + idle_calls = ts->idle_calls; + idle_sleeps = ts->idle_sleeps; memset(ts, 0, sizeof(*ts)); ts->idle_sleeptime = idle_sleeptime; ts->iowait_sleeptime = iowait_sleeptime; + ts->idle_calls = idle_calls; + ts->idle_sleeps = idle_sleeps; } #endif