Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752365AbdGEIql (ORCPT ); Wed, 5 Jul 2017 04:46:41 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36327 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750796AbdGEIqj (ORCPT ); Wed, 5 Jul 2017 04:46:39 -0400 From: Ganesh Mahendran To: linux-kernel@vger.kernel.org Cc: mingo@redhat.com, peterz@infradead.org, stable@vger.kernel.org, Ganesh Mahendran Subject: [PATCH] sched/fair: fix contribution calculation Date: Wed, 5 Jul 2017 16:46:30 +0800 Message-Id: <1499244390-4406-1-git-send-email-opensource.ganesh@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 813 Lines: 26 Function __compute_runnable_contrib() is to calculate: \Sum 1024*y^n {for (1..n_period)} But LOAD_AVG_MAX returns sum of 1024*y^n (0..n_period). So we need to subtract 1024*y^0. Cc: stable@vger.kernel.org Signed-off-by: Ganesh Mahendran --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 90e26b1..777ad49 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2508,7 +2508,7 @@ static u32 __compute_runnable_contrib(u64 n) if (likely(n <= LOAD_AVG_PERIOD)) return runnable_avg_yN_sum[n]; else if (unlikely(n >= LOAD_AVG_MAX_N)) - return LOAD_AVG_MAX; + return LOAD_AVG_MAX - 1024; /* Compute \Sum k^n combining precomputed values for k^i, \Sum k^j */ do { -- 1.9.1