From patchwork Fri Oct 18 13:26:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 176839 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp861882ill; Fri, 18 Oct 2019 06:27:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxI5PN7KbJqh2IfuuQCtI/JdF8xQDobQtrRmgi8ukqSi9xJSAvMx6oXcN+vT6Op0tarrJ3K X-Received: by 2002:aa7:d687:: with SMTP id d7mr9639129edr.143.1571405240809; Fri, 18 Oct 2019 06:27:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571405240; cv=none; d=google.com; s=arc-20160816; b=ZQlmTiC0H5wTWbv1WGDh54AqbLi0OmUgJ8uv6M/172y1LsDc2oT/qpuxBhcfzfPJ4d wQ7uInuGhxR6uME0eAgMrhk6eZKp2zKP8Qp3+TttyQuAVEgsSgk9N1kEwEczDSfcIGTJ CIzdQtAROCvqC5m127bDXp7oKaUgzMTRtUNagQwnXSdwNU/JP+xn1mmPvxDajjkCpxXN 5byDvG7z8tfkO8Ro9DW2XW2fd1J+O4T7fHmXSQ/ui6xmaVbgi7Y1IddY+VTi3lNV2M2J szedwxp3S1a3K3fRZDftcd5nQAQyaanH1PB5KxozGtHpxthKk7lpkAYQW/CJzzH6zgt/ YiVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=+8jnwsi/OmvMHtm1PwUS69bLbdlbxHcNftrW5yRwhLg=; b=Pd935AxYxQ1/l2/XXL2HGuGe/4BjxTncPwAH16jCq9Gea958Su1+Dp2PT5g8l0oXGA VE/fXpzdPI9ZGBM7jrKnxcH/V6I5WOlBufytx+Ns9TBLXPPIzAmDZnUbixcwhF8XIaOt Gkgn2CQV6pQk8KXz6giCqfJvcj8Vpew21tmGzinEQ/wC8XKfS/9oUG19assxHqAdceQS QQYVj89//0wzv5ogIWOuqgCtNhcA/ohDCTcOFU/F7uf1SQjoSV8Dp2QFjPRFrCOpi6xf XwSf5Y+ZfQKhOSZRfMYxniymLIkHq/F5Rmf4tPkJSa5/RUURwRbf+MYjLqmuicLaX08b HjPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FjJZTlYA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u27si3475775ejb.172.2019.10.18.06.27.20; Fri, 18 Oct 2019 06:27:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FjJZTlYA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2634100AbfJRN1Q (ORCPT + 26 others); Fri, 18 Oct 2019 09:27:16 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45104 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410324AbfJRN1A (ORCPT ); Fri, 18 Oct 2019 09:27:00 -0400 Received: by mail-wr1-f65.google.com with SMTP id q13so1296910wrs.12 for ; Fri, 18 Oct 2019 06:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+8jnwsi/OmvMHtm1PwUS69bLbdlbxHcNftrW5yRwhLg=; b=FjJZTlYA8PpPgWv6KZYWHaxO2XAZZBU9r+ZOPZQwTUDI0H8meXrJbKqMRqJpbPJ1VI iZcv2qeW2BZ4CM3PAxjJUZSdAQnB2vrBsZZsqiAeqCOFvDDLe5aKyhxztqq0WGmaV7Ki F1/solils4dofYwDL1hPx5ZcpkayypL3pbIBN2bJhqV3sn9rlHxyBERi8i27egDPh25y d0V54tpUCmEeafhIzyX025Xpb/vvRzFMsYWgs5mDo02hfJXjUR1mGo963Qz5zFVp143U 2XZguQgVtZZUWRUemHyMQs1EyHMN4aq080amxvz42hv017cexxLGEt71iKZdTvAaec1c OXWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+8jnwsi/OmvMHtm1PwUS69bLbdlbxHcNftrW5yRwhLg=; b=jymF2IL14LatddNJKQ4krIoEoksE7e/5tUNG28Sswzh/15xoNQq8jyOWB7mom/P/D7 Owl2TJziWUfl3lWyzJFJIlXwvBnu+F1hIx7OgoWF90x1BUQ/ZU+MmrM6n13sOWyu0tKU brL2h5F626i9Aqaqftr1ZvwHNHnxYQAsp9Ot0s1UcTUXvAmEwkM1KfH9SDJ5y+QI3dm5 qlUp0qiFtNrvOAAOp30MO3OBeR24UvSmGAQAdf5eXLc35rjd/TXe69+HVGuzcU2tpVhn RPQsx3gNLLdX/r1gvEZbbzXnqduf0j/xWexMWWbnqJrD8/3HsKxs7hIT5w7tikTSE6+4 OA0A== X-Gm-Message-State: APjAAAWvaxSoB5GmpLKEDktyak4EN5Bkf/X36POe8iIMqezEPbDdIlka 7d8viuKlMA+p84l86MbcxGnsv+Rs/hY= X-Received: by 2002:a5d:408f:: with SMTP id o15mr7115548wrp.139.1571405218501; Fri, 18 Oct 2019 06:26:58 -0700 (PDT) Received: from localhost.localdomain (91-160-61-128.subs.proxad.net. [91.160.61.128]) by smtp.gmail.com with ESMTPSA id p15sm5870123wrs.94.2019.10.18.06.26.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Oct 2019 06:26:57 -0700 (PDT) From: Vincent Guittot To: linux-kernel@vger.kernel.org, mingo@redhat.com, peterz@infradead.org Cc: pauld@redhat.com, valentin.schneider@arm.com, srikar@linux.vnet.ibm.com, quentin.perret@arm.com, dietmar.eggemann@arm.com, Morten.Rasmussen@arm.com, hdanton@sina.com, parth@linux.ibm.com, riel@surriel.com, Vincent Guittot Subject: [PATCH v4 08/11] sched/fair: use utilization to select misfit task Date: Fri, 18 Oct 2019 15:26:35 +0200 Message-Id: <1571405198-27570-9-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1571405198-27570-1-git-send-email-vincent.guittot@linaro.org> References: <1571405198-27570-1-git-send-email-vincent.guittot@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org utilization is used to detect a misfit task but the load is then used to select the task on the CPU which can lead to select a small task with high weight instead of the task that triggered the misfit migration. Check that task can't fit the CPU's capacity when selecting the misfit task instead of using the load. Signed-off-by: Vincent Guittot Acked-by: Valentin Schneider --- kernel/sched/fair.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 9b8e20d..670856d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7418,13 +7418,8 @@ static int detach_tasks(struct lb_env *env) break; case migrate_misfit: - load = task_h_load(p); - - /* - * load of misfit task might decrease a bit since it has - * been recorded. Be conservative in the condition. - */ - if (load / 2 < env->imbalance) + /* This is not a misfit task */ + if (task_fits_capacity(p, capacity_of(env->src_cpu))) goto next; env->imbalance = 0; @@ -8368,7 +8363,7 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s if (busiest->group_type == group_misfit_task) { /* Set imbalance to allow misfit task to be balanced. */ env->migration_type = migrate_misfit; - env->imbalance = busiest->group_misfit_task_load; + env->imbalance = 1; return; }