From patchwork Tue Feb 12 13:19:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 14761 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3A61C23E51 for ; Tue, 12 Feb 2013 13:20:16 +0000 (UTC) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by fiordland.canonical.com (Postfix) with ESMTP id D36C4A180FD for ; Tue, 12 Feb 2013 13:20:15 +0000 (UTC) Received: by mail-ve0-f179.google.com with SMTP id da11so48633veb.38 for ; Tue, 12 Feb 2013 05:20:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=l38nD4JEbF4LADfGimvW4tvy8VxVaapnbjDmw9ERkCI=; b=KHZRsm3kJCUvf3MHYx2Qu04+Ob2WpvD5yf3dpqzspu723vUGEoAT2V/HSRkHgVXFP3 8xoD2VC1v39ZffwgfVfS9i81Fr+b048moYi/iOz30QZSr0mGzZLN3365WZ8yzlwO6M83 0nD7xZScmhGCo0QbZ2c88hCjNJjqZs5ZFzsCKw6xrZziI28fEaEMyyaRJ1h6lnwnWfNi ETUSx7Ly6Qy3imgIdGHRWHzVx09G5EYZMfFauYIEYS97zJFJ81M8QbxAbAhYDjuTfT8T j5J8l7K75Nm5oWf2HjAlRl5/cgUAFmu3oTjjnBbhVeVXGjpHoGwWnmSDVnrYrTuagCbc seFg== X-Received: by 10.58.231.196 with SMTP id ti4mr23708511vec.25.1360675215355; Tue, 12 Feb 2013 05:20:15 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.252.8 with SMTP id zo8csp153394vec; Tue, 12 Feb 2013 05:20:14 -0800 (PST) X-Received: by 10.180.77.68 with SMTP id q4mr3232954wiw.10.1360675214284; Tue, 12 Feb 2013 05:20:14 -0800 (PST) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by mx.google.com with ESMTPS id j2si7490515wiv.2.2013.02.12.05.20.13 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Feb 2013 05:20:14 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.176 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=209.85.212.176; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.176 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) smtp.mail=vincent.guittot@linaro.org Received: by mail-wi0-f176.google.com with SMTP id hm14so4398348wib.9 for ; Tue, 12 Feb 2013 05:20:13 -0800 (PST) X-Received: by 10.180.97.233 with SMTP id ed9mr3097350wib.32.1360675209873; Tue, 12 Feb 2013 05:20:09 -0800 (PST) Received: from localhost.localdomain (LPuteaux-156-14-44-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPS id n10sm39643859wia.0.2013.02.12.05.20.08 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Feb 2013 05:20:08 -0800 (PST) From: Vincent Guittot To: linux-kernel@vger.kernel.org, linaro-dev@lists.linaro.org, peterz@infradead.org, mingo@kernel.org Cc: Vincent Guittot Subject: [PATCH] sched: fix env->src_cpu for active migration Date: Tue, 12 Feb 2013 14:19:55 +0100 Message-Id: <1360675195-4017-1-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQntJkYkXARtwTGxA5MBrD4K4wCTE4AoGVwx7eOFfiNeyQy0vC0XgTq77nb6ImLPFtvftf5K need_active_balance uses env->src_cpu which is set only if there is more than 1 task on the run queue. We must set the src_cpu field unconditionnally otherwise the test "env->src_cpu > env->dst_cpu" will always fail if there is only 1 task on the run queue Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 81fa536..32938ea 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5044,6 +5044,10 @@ redo: ld_moved = 0; lb_iterations = 1; + + env.src_cpu = busiest->cpu; + env.src_rq = busiest; + if (busiest->nr_running > 1) { /* * Attempt to move tasks. If find_busiest_group has found @@ -5052,8 +5056,6 @@ redo: * correctly treated as an imbalance. */ env.flags |= LBF_ALL_PINNED; - env.src_cpu = busiest->cpu; - env.src_rq = busiest; env.loop_max = min(sysctl_sched_nr_migrate, busiest->nr_running); update_h_load(env.src_cpu);