From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757652Ab2D3X6N (ORCPT ); Mon, 30 Apr 2012 19:58:13 -0400 Received: from mail-qa0-f46.google.com ([209.85.216.46]:33065 "EHLO mail-qa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757474Ab2D3X6J (ORCPT ); Mon, 30 Apr 2012 19:58:09 -0400 From: Frederic Weisbecker To: LKML , linaro-sched-sig@lists.linaro.org Cc: Frederic Weisbecker , Alessio Igor Bogani , Andrew Morton , Avi Kivity , Chris Metcalf , Christoph Lameter , Daniel Lezcano , Geoff Levand , Gilad Ben Yossef , Hakan Akkan , Ingo Molnar , Kevin Hilman , Max Krasnyansky , "Paul E. McKenney" , Peter Zijlstra , Stephen Hemminger , Steven Rostedt , Sven-Thorsten Dietrich , Thomas Gleixner Subject: [PATCH 34/41] sched: Update clock of nohz busiest rq before balancing Date: Tue, 1 May 2012 01:55:08 +0200 Message-Id: <1335830115-14335-35-git-send-email-fweisbec@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1335830115-14335-1-git-send-email-fweisbec@gmail.com> References: <1335830115-14335-1-git-send-email-fweisbec@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org move_tasks() and active_load_balance_cpu_stop() both need to have the busiest rq clock uptodate because they may end up calling can_migrate_task() that uses rq->clock_task to determine if the task running in the busiest runqueue is cache hot. Hence if the busiest runqueue is tickless, update its clock before reading it. Signed-off-by: Frederic Weisbecker Cc: Alessio Igor Bogani Cc: Andrew Morton Cc: Avi Kivity Cc: Chris Metcalf Cc: Christoph Lameter Cc: Daniel Lezcano Cc: Geoff Levand Cc: Gilad Ben Yossef Cc: Hakan Akkan Cc: Ingo Molnar Cc: Kevin Hilman Cc: Max Krasnyansky Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Stephen Hemminger Cc: Steven Rostedt Cc: Sven-Thorsten Dietrich Cc: Thomas Gleixner --- kernel/sched/fair.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 42a87d7..eff80e0 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4455,6 +4455,7 @@ static int load_balance(int this_cpu, struct rq *this_rq, int *balance) { int ld_moved, lb_flags = 0, active_balance = 0; + int clock_updated; struct sched_group *group; unsigned long imbalance; struct rq *busiest; @@ -4488,6 +4489,7 @@ redo: schedstat_add(sd, lb_imbalance[idle], imbalance); ld_moved = 0; + clock_updated = 0; if (busiest->nr_running > 1) { /* * Attempt to move tasks. If find_busiest_group has found @@ -4498,6 +4500,12 @@ redo: lb_flags |= LBF_ALL_PINNED; local_irq_save(flags); double_rq_lock(this_rq, busiest); + /* + * Move tasks may end up calling can_migrate_task() which + * requires an uptodate value of the rq clock. + */ + update_nohz_rq_clock(busiest); + clock_updated = 1; ld_moved = move_tasks(this_rq, this_cpu, busiest, imbalance, sd, idle, &lb_flags); double_rq_unlock(this_rq, busiest); @@ -4563,6 +4571,13 @@ redo: busiest->active_balance = 1; busiest->push_cpu = this_cpu; active_balance = 1; + /* + * active_load_balance_cpu_stop may end up calling + * can_migrate_task() which requires an uptodate + * value of the rq clock. + */ + if (!clock_updated) + update_nohz_rq_clock(busiest); } raw_spin_unlock_irqrestore(&busiest->lock, flags); -- 1.7.5.4