From patchwork Mon Jun 30 16:05:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 32780 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f200.google.com (mail-ig0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0EEA6203C0 for ; Mon, 30 Jun 2014 16:09:16 +0000 (UTC) Received: by mail-ig0-f200.google.com with SMTP id hn18sf18709078igb.11 for ; Mon, 30 Jun 2014 09:09:15 -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=5BsrhV/BJPQXon7DFMd9cIdsVELV51JSUZCcl6gBBiU=; b=hqp1LTZksm5EjFu8yFtDHD1H3Jy8grTw5M+N6JDzeTNFNGpqKkJEAuJML0jtfSJH7o bZ23b07Jd/aMl8eVEL7noOiCA7leUMC5gz0E+7MY1Qjj68Et+Bd92ZogdcF4oIkwyYO2 MFniTBVk4jwugoSxtLH2veToH78bzzdtTPSDzm8ytv0RhNZC6cWJMR+1XEqV/YohySBL nVvZQ4F3+gpTXFNc30xQYYTcR5kMnL78CJgVnE09kDmMXL6s0O34gYCp3T4SThrQh8cW ebHDK3UmpdxxBpGBH8z7dnMCNrN3ADA1G3Zid4/6V5ik8OOg+K34FPHeGJuu5j4sPbkf 0EhA== X-Gm-Message-State: ALoCoQlooE/HfK7D4Tz+5v4hb3q0P6oWR1kVfFv7mhKGnPT5DSghDxm4n4aWjReCqNxtCx50LzD0 X-Received: by 10.43.94.71 with SMTP id bx7mr20800610icc.2.1404144555566; Mon, 30 Jun 2014 09:09:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.203 with SMTP id c69ls997336qgd.85.gmail; Mon, 30 Jun 2014 09:09:15 -0700 (PDT) X-Received: by 10.220.203.134 with SMTP id fi6mr29103281vcb.18.1404144555370; Mon, 30 Jun 2014 09:09:15 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id c1si10216391vdw.37.2014.06.30.09.09.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 09:09:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so7823698vcb.30 for ; Mon, 30 Jun 2014 09:09:15 -0700 (PDT) X-Received: by 10.220.203.134 with SMTP id fi6mr29103269vcb.18.1404144555270; Mon, 30 Jun 2014 09:09:15 -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 tc5csp151362vcb; Mon, 30 Jun 2014 09:09:14 -0700 (PDT) X-Received: by 10.66.153.80 with SMTP id ve16mr53406164pab.143.1404144554427; Mon, 30 Jun 2014 09:09:14 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dq2si23645820pbb.118.2014.06.30.09.09.13; Mon, 30 Jun 2014 09:09:13 -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 S1756631AbaF3QJE (ORCPT + 27 others); Mon, 30 Jun 2014 12:09:04 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:36948 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755883AbaF3QG6 (ORCPT ); Mon, 30 Jun 2014 12:06:58 -0400 Received: by mail-wi0-f180.google.com with SMTP id hi2so6304739wib.7 for ; Mon, 30 Jun 2014 09:06:56 -0700 (PDT) X-Received: by 10.194.10.69 with SMTP id g5mr4100523wjb.116.1404144416859; Mon, 30 Jun 2014 09:06:56 -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 lo18sm32896271wic.1.2014.06.30.09.06.54 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 09:06:56 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org Cc: preeti@linux.vnet.ibm.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 v3 07/12] sched: test the cpu's capacity in wake affine Date: Mon, 30 Jun 2014 18:05:38 +0200 Message-Id: <1404144343-18720-8-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1404144343-18720-1-git-send-email-vincent.guittot@linaro.org> References: <1404144343-18720-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.171 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 which share its cache. Signed-off-by: Vincent Guittot Acked-by: Rik van Riel --- kernel/sched/fair.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7dff578..a23c938 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4240,6 +4240,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; @@ -4283,21 +4284,23 @@ 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); + } else if (!(sd->flags & SD_SHARE_PKG_RESOURCES)) { + this_eff_load = 0; + } + + 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)