From patchwork Fri May 23 15:53:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 30824 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 791F720369 for ; Fri, 23 May 2014 15:55:01 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id m20sf16277147qcx.5 for ; Fri, 23 May 2014 08:55:01 -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=KSCiguI8CRAozV3z4W87ZkFZnnkv0OAg5rp17HRPEdY=; b=Mr9mpbLWNhErxDylijZvQv8mALdHokzJ2X1EFxWqltO0cd9oArlF9hA6qrbaJiFLu3 N1ZK/FqXG7SSNEjTwmkzi9DqOvazQGsoHQTuS405fvgLkvIRN384YeI2542hpaVwb/4/ COQylHQrhoXtN9RYGUmH9U3/bSUFl5wrCoO+gL7T4XdMw+6yo4MyNSTLe3M6SMCWDhFp LhYFkjtKdDrBCO9jI7+v7r4oFaHI32G7nr9DgtJi4FAv+3qP6wHdwXxAxkrnEE07q1XA nV6yczduVP3k5Jr1NQuEunznbK1O311pC04nJRcudhmyqlTykk44X+miVM0prgRiH2ie NuWA== X-Gm-Message-State: ALoCoQn3uG2Ro2kNCaIKSph70HKV5K0cy3Dh5wXskILMiZhbBnoij3Bp0PKqCjlcxH71O8OTw09W X-Received: by 10.236.39.175 with SMTP id d35mr2125369yhb.12.1400860501334; Fri, 23 May 2014 08:55:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.46.53 with SMTP id j50ls1819216qga.67.gmail; Fri, 23 May 2014 08:55:01 -0700 (PDT) X-Received: by 10.220.162.6 with SMTP id t6mr5131063vcx.12.1400860501166; Fri, 23 May 2014 08:55:01 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id s14si1873533vem.73.2014.05.23.08.55.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 08:55:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id ij19so3066135vcb.23 for ; Fri, 23 May 2014 08:55:01 -0700 (PDT) X-Received: by 10.52.181.132 with SMTP id dw4mr1055604vdc.86.1400860501094; Fri, 23 May 2014 08:55:01 -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.220.221.72 with SMTP id ib8csp42738vcb; Fri, 23 May 2014 08:55:00 -0700 (PDT) X-Received: by 10.68.221.161 with SMTP id qf1mr7275911pbc.10.1400860500303; Fri, 23 May 2014 08:55:00 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ah1si4439705pbc.97.2014.05.23.08.54.59 for ; Fri, 23 May 2014 08:54:59 -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 S1753264AbaEWPyZ (ORCPT + 27 others); Fri, 23 May 2014 11:54:25 -0400 Received: from mail-we0-f182.google.com ([74.125.82.182]:46436 "EHLO mail-we0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753196AbaEWPyW (ORCPT ); Fri, 23 May 2014 11:54:22 -0400 Received: by mail-we0-f182.google.com with SMTP id t60so5135997wes.27 for ; Fri, 23 May 2014 08:54:21 -0700 (PDT) X-Received: by 10.180.182.19 with SMTP id ea19mr4244758wic.14.1400860461511; Fri, 23 May 2014 08:54:21 -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 m1sm3558594wib.20.2014.05.23.08.54.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 08:54:20 -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, Vincent Guittot Subject: [PATCH v2 09/11] sched: test the cpu's capacity in wake affine Date: Fri, 23 May 2014 17:53:03 +0200 Message-Id: <1400860385-14555-10-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1400860385-14555-1-git-send-email-vincent.guittot@linaro.org> References: <1400860385-14555-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.178 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 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 LLC. 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 c01d8b6..e8a30f9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4241,6 +4241,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; @@ -4284,21 +4285,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 *= power_of(prev_cpu); + + prev_eff_load = 100 + (sd->imbalance_pct - 100) / 2; + prev_eff_load *= power_of(this_cpu); - this_eff_load = 100; - this_eff_load *= power_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 *= power_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)