From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753249AbcB2LPg (ORCPT ); Mon, 29 Feb 2016 06:15:36 -0500 Received: from torg.zytor.com ([198.137.202.12]:54250 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752021AbcB2LPe (ORCPT ); Mon, 29 Feb 2016 06:15:34 -0500 Date: Mon, 29 Feb 2016 03:14:29 -0800 From: tip-bot for Byungchul Park Message-ID: Cc: cl@linux.com, fweisbec@gmail.com, efault@gmx.de, paulmck@linux.vnet.ibm.com, peterz@infradead.org, tglx@linutronix.de, torvalds@linux-foundation.org, riel@redhat.com, lcapitulino@redhat.com, byungchul.park@lge.com, mingo@kernel.org, cmetcalf@ezchip.com, linux-kernel@vger.kernel.org, dietmar.eggemann@arm.com, hpa@zytor.com Reply-To: dietmar.eggemann@arm.com, linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org, byungchul.park@lge.com, cmetcalf@ezchip.com, tglx@linutronix.de, torvalds@linux-foundation.org, lcapitulino@redhat.com, riel@redhat.com, fweisbec@gmail.com, cl@linux.com, peterz@infradead.org, paulmck@linux.vnet.ibm.com, efault@gmx.de In-Reply-To: <20160115070749.GA1914@X58A-UD3R> References: <20160115070749.GA1914@X58A-UD3R> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/fair: Avoid using decay_load_missed() with a negative value Git-Commit-ID: 7400d3bbaa229eb8e7631d28fb34afd7cd2c96ff X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 7400d3bbaa229eb8e7631d28fb34afd7cd2c96ff Gitweb: http://git.kernel.org/tip/7400d3bbaa229eb8e7631d28fb34afd7cd2c96ff Author: Byungchul Park AuthorDate: Fri, 15 Jan 2016 16:07:49 +0900 Committer: Ingo Molnar CommitDate: Mon, 29 Feb 2016 09:53:03 +0100 sched/fair: Avoid using decay_load_missed() with a negative value decay_load_missed() cannot handle nagative values, so we need to prevent using the function with a negative value. Reported-by: Dietmar Eggemann Signed-off-by: Byungchul Park Signed-off-by: Peter Zijlstra (Intel) Cc: Chris Metcalf Cc: Christoph Lameter Cc: Frederic Weisbecker Cc: Linus Torvalds Cc: Luiz Capitulino Cc: Mike Galbraith Cc: Paul E . McKenney Cc: Peter Zijlstra Cc: Rik van Riel Cc: Thomas Gleixner Cc: perterz@infradead.org Fixes: 59543275488d ("sched/fair: Prepare __update_cpu_load() to handle active tickless") Link: http://lkml.kernel.org/r/20160115070749.GA1914@X58A-UD3R Signed-off-by: Ingo Molnar --- kernel/sched/fair.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 5641042..3b3dc39 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4509,9 +4509,17 @@ static void __update_cpu_load(struct rq *this_rq, unsigned long this_load, /* scale is effectively 1 << i now, and >> i divides by scale */ - old_load = this_rq->cpu_load[i] - tickless_load; + old_load = this_rq->cpu_load[i]; old_load = decay_load_missed(old_load, pending_updates - 1, i); - old_load += tickless_load; + if (tickless_load) { + old_load -= decay_load_missed(tickless_load, pending_updates - 1, i); + /* + * old_load can never be a negative value because a + * decayed tickless_load cannot be greater than the + * original tickless_load. + */ + old_load += tickless_load; + } new_load = this_load; /* * Round up the averaging division if load is increasing. This