From patchwork Fri May 23 15:52:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 30821 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3E3B120AEA for ; Fri, 23 May 2014 15:54:25 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id oz11sf18443547veb.6 for ; Fri, 23 May 2014 08:54:25 -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=/T8fx8WpceNCQKEmfnFYaxKjPBPypYHUpJjSZoET2lw=; b=HJvAKKCGdvIkHuJUMvRIQnoVljZMVfV3yN0LvgSy+pw4Pnh0Q78ZS/oxjT1t2Sv+nN HI5ezFjoQOpd0FFNwyVdEHL/6Y9N9oUHtRFIWm1iABpy+7hg2zB1H7dQdnz+4r/2hlWZ kuJSFlXiAu7oLUA+wGj1JhBPxNbwWG/YxRDKniw7EuhP1GCfH2F8mf1iUxWVzLQWyLK4 oZB4SlIJs6Y2vbu1p8u8VvRvmVXpT6VJKQMxf9Dp/Q6b5RUOv7a6GdknsUt0tEE+u791 NY95J0zcjh88av7xUziuwmdpx7xQK+IQtB4aFKwlecYg6jLuD6DjswbETqlNoYH4k1hB dKfA== X-Gm-Message-State: ALoCoQnkHq+FM0VFOskrKGm3C/EjwhgFJyqoaETFWKbsfaEGfuf/6dFDo/s5qxkZIFVvCI95UxXe X-Received: by 10.58.141.200 with SMTP id rq8mr1980660veb.31.1400860465078; Fri, 23 May 2014 08:54:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.98.225 with SMTP id o88ls470602qge.88.gmail; Fri, 23 May 2014 08:54:25 -0700 (PDT) X-Received: by 10.220.163.3 with SMTP id y3mr5002407vcx.7.1400860464991; Fri, 23 May 2014 08:54:24 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id im2si1879386veb.47.2014.05.23.08.54.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 08:54:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hq11so675700vcb.8 for ; Fri, 23 May 2014 08:54:24 -0700 (PDT) X-Received: by 10.58.216.163 with SMTP id or3mr719453vec.80.1400860464791; Fri, 23 May 2014 08:54:24 -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 ib8csp42686vcb; Fri, 23 May 2014 08:54:24 -0700 (PDT) X-Received: by 10.66.137.109 with SMTP id qh13mr7073861pab.39.1400860464014; Fri, 23 May 2014 08:54:24 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rq2si4406078pbc.163.2014.05.23.08.54.23 for ; Fri, 23 May 2014 08:54:23 -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 S1752848AbaEWPyL (ORCPT + 27 others); Fri, 23 May 2014 11:54:11 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:62983 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751795AbaEWPyJ (ORCPT ); Fri, 23 May 2014 11:54:09 -0400 Received: by mail-wi0-f172.google.com with SMTP id hi2so1066809wib.11 for ; Fri, 23 May 2014 08:54:08 -0700 (PDT) X-Received: by 10.194.79.36 with SMTP id g4mr2965360wjx.71.1400860448641; Fri, 23 May 2014 08:54:08 -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.06 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 08:54:07 -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 02/11] sched: remove a wake_affine condition Date: Fri, 23 May 2014 17:52:56 +0200 Message-Id: <1400860385-14555-3-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.177 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: , I have tried to understand the meaning of the condition : (this_load <= load && this_load + target_load(prev_cpu, idx) <= tl_per_task) but i failed to find a use case that can take advantage of it and i haven't found description of it in the previous commits' log. Futhermore, the comment of the condition refers to task_hot function that was used before being replaced by the current condition: /* * This domain has SD_WAKE_AFFINE and * p is cache cold in this domain, and * there is no bad imbalance. */ If we look more deeply the below condition this_load + target_load(prev_cpu, idx) <= tl_per_task When sync is clear, we have : tl_per_task = runnable_load_avg / nr_running this_load = max(runnable_load_avg, cpuload[idx]) target_load = max(runnable_load_avg', cpuload'[idx]) It implies that runnable_load_avg' == 0 and nr_running <= 1 in order to match the condition. This implies that runnable_load_avg == 0 too because of the condition: this_load <= load but if this _load is null, balanced is already set and the test is redundant. If sync is set, it's not as straight forward as above (especially if cgroup are involved) but the policy should be similar as we have removed a task that's going to sleep in order to get a more accurate load and this_load values. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 9587ed1..30240ab 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4238,7 +4238,6 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync) { s64 this_load, load; int idx, this_cpu, prev_cpu; - unsigned long tl_per_task; struct task_group *tg; unsigned long weight; int balanced; @@ -4296,32 +4295,22 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync) balanced = this_eff_load <= prev_eff_load; } else balanced = true; + schedstat_inc(p, se.statistics.nr_wakeups_affine_attempts); + if (!balanced) + return 0; /* * If the currently running task will sleep within * a reasonable amount of time then attract this newly * woken task: */ - if (sync && balanced) + if (sync) return 1; - schedstat_inc(p, se.statistics.nr_wakeups_affine_attempts); - tl_per_task = cpu_avg_load_per_task(this_cpu); - - if (balanced || - (this_load <= load && - this_load + target_load(prev_cpu, idx) <= tl_per_task)) { - /* - * This domain has SD_WAKE_AFFINE and - * p is cache cold in this domain, and - * there is no bad imbalance. - */ - schedstat_inc(sd, ttwu_move_affine); - schedstat_inc(p, se.statistics.nr_wakeups_affine); + schedstat_inc(sd, ttwu_move_affine); + schedstat_inc(p, se.statistics.nr_wakeups_affine); - return 1; - } - return 0; + return 1; } /*