From patchwork Thu May 30 15:23:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 17306 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f199.google.com (mail-we0-f199.google.com [74.125.82.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DBBBD25D81 for ; Thu, 30 May 2013 15:23:27 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id p58sf402546wes.2 for ; Thu, 30 May 2013 08:23:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=TV/FDZzOtUV0VCq4SNoRcZY/bz+dgPD16O7K8EfEDpk=; b=J5DxN1e40KS3VZzbvucyqHGct8bt06ZcsBpXMSKcA8KzFOnUJ4Rgu6l7sw1y/wTm7V a3AdhF1HzON1VWUXEdZf778GMmLrsPsXKhP8/SCq1lAhW9CrTVERG87FLM4PuuHfbg/O 47yYxRc6vaWyG1/rX8/vrHNX3QyeiiCu1MlqAHc/ClsVfqcD2PlJqjBqwj9Rnwg3Anf4 6FiLJyxOrXvqHnxnGb76WEsZ80sGdwIKZ00U40xbPeUp9ebJoNWpPpiTfFSPh85utuPN 1RzBBeYRfXuvWDRlApe2BY3BXa8XQ+AynEd0YIb18eFu71zfhtd+U2fbFxoLUwOCmF+h ZPYQ== X-Received: by 10.180.11.232 with SMTP id t8mr2820360wib.3.1369927406743; Thu, 30 May 2013 08:23:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.198.142 with SMTP id jc14ls1715627wic.34.canary; Thu, 30 May 2013 08:23:26 -0700 (PDT) X-Received: by 10.180.184.75 with SMTP id es11mr5127721wic.38.1369927406605; Thu, 30 May 2013 08:23:26 -0700 (PDT) Received: from mail-ve0-x22c.google.com (mail-ve0-x22c.google.com [2607:f8b0:400c:c01::22c]) by mx.google.com with ESMTPS id gj3si8442276wic.21.2013.05.30.08.23.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 May 2013 08:23:26 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22c is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22c; Received: by mail-ve0-f172.google.com with SMTP id jz10so286502veb.17 for ; Thu, 30 May 2013 08:23:25 -0700 (PDT) X-Received: by 10.220.10.212 with SMTP id q20mr6085281vcq.9.1369927405549; Thu, 30 May 2013 08:23:25 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.229.199 with SMTP id jj7csp12555vcb; Thu, 30 May 2013 08:23:24 -0700 (PDT) X-Received: by 10.180.39.233 with SMTP id s9mr5154880wik.25.1369927404463; Thu, 30 May 2013 08:23:24 -0700 (PDT) Received: from mail-we0-x236.google.com (mail-we0-x236.google.com [2a00:1450:400c:c03::236]) by mx.google.com with ESMTPS id b12si8442172wic.20.2013.05.30.08.23.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 May 2013 08:23:24 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::236 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=2a00:1450:400c:c03::236; Received: by mail-we0-f182.google.com with SMTP id q57so360254wes.41 for ; Thu, 30 May 2013 08:23:24 -0700 (PDT) X-Received: by 10.180.210.242 with SMTP id mx18mr5201211wic.14.1369927403975; Thu, 30 May 2013 08:23:23 -0700 (PDT) Received: from localhost.localdomain (LPuteaux-156-14-44-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPSA id m3sm38667251wij.5.2013.05.30.08.23.22 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 May 2013 08:23:23 -0700 (PDT) From: Vincent Guittot To: linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, peterz@infradead.org, mingo@kernel.org, fweisbec@gmail.com Cc: Vincent Guittot Subject: [PATCH] sched: fix clear NOHZ_BALANCE_KICK Date: Thu, 30 May 2013 17:23:05 +0200 Message-Id: <1369927385-7801-1-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQk69Muuk/wyys0OV2ik3hmUM/0hxjar5JaeX3GUZn7hkYaiRgc0D2oR+AvQ7lOrdZr+9lpW X-Original-Sender: vincent.guittot@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22c is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , I have faced a sequence where the Idle Load Balance was sometime not triggered for a while on my platform. CPU 0 and CPU 1 are running tasks and CPU 2 is idle CPU 1 kicks the Idle Load Balance CPU 1 selects CPU 2 as the new Idle Load Balancer CPU 1 sets NOHZ_BALANCE_KICK for CPU 2 CPU 1 sends a reschedule IPI to CPU 2 While CPU 2 wakes up, CPU 0 or CPU 1 migrates a waking task A on CPU 2 CPU 2 finally wakes up, runs task A and discards the Idle Load Balance Task A quickly goes back to sleep (before a tick occurs on CPU 2) CPU 2 goes back to idle with NOHZ_BALANCE_KICK set Whenever CPU 2 will be selected for the ILB, reschedule IPI will be not sent to CPU2, which is idle, because NOHZ_BALANCE_KICK is already set and no Idle Load Balance will be performed. We must wait for the sched softirq to be raised on CPU 2 thanks to another part of the kernel to clear NOHZ_BALANCE_KICKand come back to a normal situation. The proposed solution clears NOHZ_BALANCE_KICK in schedule_ipi if we can't raise the sched_softirq for the Idle Load Balance. Signed-off-by: Vincent Guittot --- kernel/sched/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 58453b8..51fc715 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1420,7 +1420,8 @@ void scheduler_ipi(void) if (unlikely(got_nohz_idle_kick() && !need_resched())) { this_rq()->idle_balance = 1; raise_softirq_irqoff(SCHED_SOFTIRQ); - } + } else + clear_bit(NOHZ_BALANCE_KICK, nohz_flags(smp_processor_id())); irq_exit(); }