Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933090AbdCJUYG (ORCPT ); Fri, 10 Mar 2017 15:24:06 -0500 Received: from mail-wr0-f171.google.com ([209.85.128.171]:33152 "EHLO mail-wr0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755427AbdCJUXx (ORCPT ); Fri, 10 Mar 2017 15:23:53 -0500 From: Joel Fernandes To: linux-kernel@vger.kernel.org Cc: Joel Fernandes , Paul Turner , Dietmar Eggemann , Juri Lelli , Patrick Bellasi , Peter Zijlstra , Ingo Molnar Subject: [PATCH] sched: fair: Improve PELT decay_load calculation comments Date: Fri, 10 Mar 2017 12:23:41 -0800 Message-Id: <20170310202341.11449-1-joelaf@google.com> X-Mailer: git-send-email 2.12.0.246.ga2ecc84866-goog Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1633 Lines: 42 The PELT decay_load comments are a bit confusing, first of all the 1/2^N should be (1/2)^N so that the reader doesn't get confused. Secondly, the y^N splitting into a 2-part decay factor deserves a better explanation. This patch improves the comments. Cc: Paul Turner Cc: Dietmar Eggemann Cc: Juri Lelli Cc: Patrick Bellasi Cc: Peter Zijlstra Signed-off-by: Joel Fernandes --- kernel/sched/fair.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6559d197e08a..1e1f2d77751e 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2761,11 +2761,15 @@ static __always_inline u64 decay_load(u64 val, u64 n) local_n = n; /* - * As y^PERIOD = 1/2, we can combine - * y^n = 1/2^(n/PERIOD) * y^(n%PERIOD) - * With a look-up table which covers y^n (n= LOAD_AVG_PERIOD)) { val >>= local_n / LOAD_AVG_PERIOD; -- 2.12.0.246.ga2ecc84866-goog