From patchwork Mon Jul 28 17:51:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 34399 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f71.google.com (mail-qg0-f71.google.com [209.85.192.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8C5E7202E4 for ; Mon, 28 Jul 2014 18:00:45 +0000 (UTC) Received: by mail-qg0-f71.google.com with SMTP id f51sf16763667qge.2 for ; Mon, 28 Jul 2014 11:00:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=wathGo3GGbdtv3xyP8Rfwui50WkEELJwVDKL5N+kw/c=; b=a9uOBanil/cA7QUPI9TJKM1zLlozpepwC2Rt45Yo1dx8SvSI5w+PPnp5sv2mAyWGfW NOPxJJTBXmo+4JdV2ppouW89ehRphmAxGTgievGalWpG0fhDmmJzU446E4zNK2DuWBaO lFe49Gq/TgmpXQ/28fGLfrBfTqH3+Z/bNrf1uPfdj665MktrH8xM5UhWNOexMNqBPo0u dlcm/yvHFvyyDRgX51pchg+D9AP8KA6OcJEOhA7gwhMbkLeXKnJSJ6Ijwhom7NZB/qS9 IlZMrS/79PCNvoeQ+ZukPL3nOSddrRkjXVc0bJsSb6rAD4rvP/Q4l/+8L6iGzMbdtBsV cOEw== X-Gm-Message-State: ALoCoQkv6efymE6dCs0Xp10HwzgwRYLVCdSvPIYURjzElmopMpxInJdlzhOFH30jktazCS+A4hZP X-Received: by 10.236.124.161 with SMTP id x21mr15118462yhh.48.1406570445289; Mon, 28 Jul 2014 11:00:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.233 with SMTP id j96ls2232518qgd.80.gmail; Mon, 28 Jul 2014 11:00:45 -0700 (PDT) X-Received: by 10.220.118.136 with SMTP id v8mr2559068vcq.50.1406570445110; Mon, 28 Jul 2014 11:00:45 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id q6si12994160veh.50.2014.07.28.11.00.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Jul 2014 11:00:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id lf12so11704060vcb.26 for ; Mon, 28 Jul 2014 11:00:45 -0700 (PDT) X-Received: by 10.221.47.9 with SMTP id uq9mr2596629vcb.48.1406570444850; Mon, 28 Jul 2014 11:00:44 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp186305vcb; Mon, 28 Jul 2014 11:00:44 -0700 (PDT) X-Received: by 10.68.57.140 with SMTP id i12mr40619878pbq.44.1406570014376; Mon, 28 Jul 2014 10:53:34 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qc2si9288155pdb.307.2014.07.28.10.53.33 for ; Mon, 28 Jul 2014 10:53:34 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751693AbaG1Rwz (ORCPT + 26 others); Mon, 28 Jul 2014 13:52:55 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:34675 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751581AbaG1Rwu (ORCPT ); Mon, 28 Jul 2014 13:52:50 -0400 Received: by mail-we0-f174.google.com with SMTP id x48so7760011wes.5 for ; Mon, 28 Jul 2014 10:52:48 -0700 (PDT) X-Received: by 10.180.80.133 with SMTP id r5mr32753804wix.62.1406569968709; Mon, 28 Jul 2014 10:52:48 -0700 (PDT) Received: from lmenx30s.lme.st.com (LPuteaux-656-01-48-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPSA id ex4sm33758149wic.2.2014.07.28.10.52.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Jul 2014 10:52:47 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, preeti@linux.vnet.ibm.com, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org Cc: riel@redhat.com, Morten.Rasmussen@arm.com, efault@gmx.de, nicolas.pitre@linaro.org, linaro-kernel@lists.linaro.org, daniel.lezcano@linaro.org, dietmar.eggemann@arm.com, Vincent Guittot Subject: [PATCH v4 07/12] sched: test the cpu's capacity in wake affine Date: Mon, 28 Jul 2014 19:51:41 +0200 Message-Id: <1406569906-9763-8-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1406569906-9763-1-git-send-email-vincent.guittot@linaro.org> References: <1406569906-9763-1-git-send-email-vincent.guittot@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vincent.guittot@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Currently the task always wakes affine on this_cpu if the latter is idle. Before waking up the task on this_cpu, we check that this_cpu capacity is not significantly reduced because of RT tasks or irq activity. Use case where the number of irq and/or the time spent under irq is important will take benefit of this because the task that is woken up by irq or softirq will not use the same CPU than irq (and softirq) but a idle one. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f6258bc..6843016 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4284,6 +4284,7 @@ static int wake_wide(struct task_struct *p) static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync) { s64 this_load, load; + s64 this_eff_load, prev_eff_load; int idx, this_cpu, prev_cpu; struct task_group *tg; unsigned long weight; @@ -4327,21 +4328,21 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync) * Otherwise check if either cpus are near enough in load to allow this * task to be woken on this_cpu. */ - if (this_load > 0) { - s64 this_eff_load, prev_eff_load; + this_eff_load = 100; + this_eff_load *= capacity_of(prev_cpu); + + prev_eff_load = 100 + (sd->imbalance_pct - 100) / 2; + prev_eff_load *= capacity_of(this_cpu); - this_eff_load = 100; - this_eff_load *= capacity_of(prev_cpu); + if (this_load > 0) { this_eff_load *= this_load + effective_load(tg, this_cpu, weight, weight); - prev_eff_load = 100 + (sd->imbalance_pct - 100) / 2; - prev_eff_load *= capacity_of(this_cpu); prev_eff_load *= load + effective_load(tg, prev_cpu, 0, weight); + } + + balanced = this_eff_load <= prev_eff_load; - balanced = this_eff_load <= prev_eff_load; - } else - balanced = true; schedstat_inc(p, se.statistics.nr_wakeups_affine_attempts); if (!balanced)