Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp657167ybb; Fri, 20 Mar 2020 06:00:58 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtuGhxcUEpodU4Q7iH1y3fLKlJfKi7vlxXIGaF0g6SeMq+LUz7crdCVbVuvwkT0qXHZnlw/ X-Received: by 2002:aca:7213:: with SMTP id p19mr6000409oic.44.1584709258226; Fri, 20 Mar 2020 06:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584709258; cv=none; d=google.com; s=arc-20160816; b=lYipAJIC+ITJF3k840bCaVmpV2JbM+T7YbtZZBUpLI8FuUx/txS6iDDbaKZXRwUEJf DhV8aMZkrPoPd/7bkb5VD27RBcvK4rnOgTn1XlJ6+NTUwEzmhG3u7RRAiF3e4o66S+b2 ZxSEgEciu/rgWS9aL5qNA8YGPGZKJ0ra4k37WW2ANCdHOTtwHxF6mIoUAn/ceWGoDZ9R dVv2KipYwi1B/tBiwYwqiv0bQZ+UgNeYTsBiat/mkeQE5Q9lnt5SDiycltrEaAQ0XtXg bOii6mx7fQ0J9a02suqC2rEhTqNPzU8jtLk8FHykiWPZGCFGa7x2kpaLZ9ZmDJcUq53B Sy1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=+OYd1vCkZR0qevuplpYEcvP2Gs9mqc/q0GmTQNHgqSU=; b=Tw0uh3V3EDQ23aTsKvWG1mkKptC8ZPca96wLWDNtxzZ8XHLzU0HbtTqG6ODhW8tmAx jnHqfFMKA7ZV6nAQbCc40lb2/LFS09hSJFpKhoqUC4gq1DmCPXcuZzQ/aEn1s9wyLXpH eEvh/wutR2nLkd4T9a/KLwwnk8vHpY9Yp3i2QCs1h4XxArN+hlcMddXQmjaBXSGq/Lk9 2W6eu1CFEVsz+4MYaloXjDLd6zyewdjhYAhaw0h3MGH87PpaZMyc5N8ObOeKYJo2ZPCe Vwbvdddmb29qVHkh4VorHsqzT/r/cJM/uEtCxTvSnLLl2fEE3NJIagO0t6/N7SGGt87I fKeQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b187si274455oif.221.2020.03.20.06.00.45; Fri, 20 Mar 2020 06:00:58 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727535AbgCTM7P (ORCPT + 99 others); Fri, 20 Mar 2020 08:59:15 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:35619 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727133AbgCTM6L (ORCPT ); Fri, 20 Mar 2020 08:58:11 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jFHDz-0003ie-Jp; Fri, 20 Mar 2020 13:58:07 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 258F51C22BF; Fri, 20 Mar 2020 13:58:04 +0100 (CET) Date: Fri, 20 Mar 2020 12:58:03 -0000 From: "tip-bot2 for Vincent Guittot" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/fair: Improve spreading of utilization Cc: Vincent Guittot , "Peter Zijlstra (Intel)" , x86 , LKML In-Reply-To: <20200312165429.990-1-vincent.guittot@linaro.org> References: <20200312165429.990-1-vincent.guittot@linaro.org> MIME-Version: 1.0 Message-ID: <158470908386.28353.10623151233945522135.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: c32b4308295aaaaedd5beae56cb42e205ae63e58 Gitweb: https://git.kernel.org/tip/c32b4308295aaaaedd5beae56cb42e205ae63e58 Author: Vincent Guittot AuthorDate: Thu, 12 Mar 2020 17:54:29 +01:00 Committer: Peter Zijlstra CommitterDate: Fri, 20 Mar 2020 13:06:20 +01:00 sched/fair: Improve spreading of utilization During load_balancing, a group with spare capacity will try to pull some utilizations from an overloaded group. In such case, the load balance looks for the runqueue with the highest utilization. Nevertheless, it should also ensure that there are some pending tasks to pull otherwise the load balance will fail to pull a task and the spread of the load will be delayed. This situation is quite transient but it's possible to highlight the effect with a short run of sysbench test so the time to spread task impacts the global result significantly. Below are the average results for 15 iterations on an arm64 octo core: sysbench --test=cpu --num-threads=8 --max-requests=1000 run tip/sched/core +patchset total time: 172ms 158ms per-request statistics: avg: 1.337ms 1.244ms max: 21.191ms 10.753ms The average max doesn't fully reflect the wide spread of the value which ranges from 1.350ms to more than 41ms for the tip/sched/core and from 1.350ms to 21ms with the patch. Other factors like waiting for an idle load balance or cache hotness can delay the spreading of the tasks which explains why we can still have up to 21ms with the patch. Signed-off-by: Vincent Guittot Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20200312165429.990-1-vincent.guittot@linaro.org --- kernel/sched/fair.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c7aaae2..783356f 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9313,6 +9313,14 @@ static struct rq *find_busiest_queue(struct lb_env *env, case migrate_util: util = cpu_util(cpu_of(rq)); + /* + * Don't try to pull utilization from a CPU with one + * running task. Whatever its utilization, we will fail + * detach the task. + */ + if (nr_running <= 1) + continue; + if (busiest_util < util) { busiest_util = util; busiest = rq;