From patchwork Mon Jul 28 17:51:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 34394 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f70.google.com (mail-oi0-f70.google.com [209.85.218.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F2C33202E4 for ; Mon, 28 Jul 2014 17:53:44 +0000 (UTC) Received: by mail-oi0-f70.google.com with SMTP id u20sf40539850oif.1 for ; Mon, 28 Jul 2014 10:53:44 -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=HvNc+cXNqqxQQ1cRXIZ5G8/yW1C5FIjcB2n3m/ayLLo=; b=IA7rMNo0bTCTSd8flGI7/XUDk4PKU3mQBAAt9+LXpjYXAp7mNXXFh9UXePTPV9RMKW QpqOWAiuYsAbUSm1Jj+OMuTRpF/Og3j0G751tFXj4ter6PaXqH5GZl3PYsM6/Pvc7Bku NBIEnyROlkefD6a38ANkxtW+83KX1bjuSy+y9lJgJeODeDM0RKSXv9i8Bx9T3iofuHod EYcvTM6okSUozANrlzfahBvz2nbJ7VjdYAiIF6L2l9VH3moDEO5d855LsW8tM5qNl4To 6zPtU8kjRse6gGeTC695Sq6RcA3hEhtz5GtEoNcPIu+Hl2f4RrIADgGRfmKgDcN8gAAQ aRLg== X-Gm-Message-State: ALoCoQkDv8e3zlBcNFRoyOfUEK2HYP/YPFag8NhdtnkMwXTdcfz4kRxUuJOfsOludkdlZ5bDmjta X-Received: by 10.182.112.202 with SMTP id is10mr17534199obb.47.1406570024557; Mon, 28 Jul 2014 10:53:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.44 with SMTP id k41ls2113699qgk.78.gmail; Mon, 28 Jul 2014 10:53:44 -0700 (PDT) X-Received: by 10.52.170.69 with SMTP id ak5mr4750164vdc.63.1406570024442; Mon, 28 Jul 2014 10:53:44 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id ke8si12947850vec.83.2014.07.28.10.53.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Jul 2014 10:53:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hq11so11529206vcb.24 for ; Mon, 28 Jul 2014 10:53:44 -0700 (PDT) X-Received: by 10.52.129.165 with SMTP id nx5mr17889473vdb.25.1406570024343; Mon, 28 Jul 2014 10:53: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 tc5csp185929vcb; Mon, 28 Jul 2014 10:53:42 -0700 (PDT) X-Received: by 10.70.37.129 with SMTP id y1mr40795289pdj.12.1406570013263; Mon, 28 Jul 2014 10:53:33 -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.11 for ; Mon, 28 Jul 2014 10:53:33 -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 S1751576AbaG1Rws (ORCPT + 26 others); Mon, 28 Jul 2014 13:52:48 -0400 Received: from mail-we0-f170.google.com ([74.125.82.170]:54491 "EHLO mail-we0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750960AbaG1Rwn (ORCPT ); Mon, 28 Jul 2014 13:52:43 -0400 Received: by mail-we0-f170.google.com with SMTP id w62so7812566wes.1 for ; Mon, 28 Jul 2014 10:52:40 -0700 (PDT) X-Received: by 10.194.202.231 with SMTP id kl7mr1828195wjc.134.1406569959347; Mon, 28 Jul 2014 10:52:39 -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.37 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Jul 2014 10:52:38 -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 02/12] sched: remove a wake_affine condition Date: Mon, 28 Jul 2014 19:51:36 +0200 Message-Id: <1406569906-9763-3-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.179 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 clear description in the previous commits' log. Futhermore, the comment of the condition refers to the 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. The current conclusion is that these additional condition don't give any benefit so we can remove them. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7eb9126..57f8d8c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4285,7 +4285,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; @@ -4343,32 +4342,15 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync) balanced = this_eff_load <= prev_eff_load; } else balanced = true; - - /* - * If the currently running task will sleep within - * a reasonable amount of time then attract this newly - * woken task: - */ - if (sync && balanced) - 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); + if (!balanced) + return 0; - return 1; - } - return 0; + schedstat_inc(sd, ttwu_move_affine); + schedstat_inc(p, se.statistics.nr_wakeups_affine); + + return 1; } /*