Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp722095ybh; Thu, 12 Mar 2020 09:55:43 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsZryKXR1+ei573tGw+NQVYfW3F49Z+y6sTzx/5THMQQiJZTQD8yHsUxof4Lv2hpKphOpWF X-Received: by 2002:a05:6808:abb:: with SMTP id r27mr3417439oij.92.1584032142831; Thu, 12 Mar 2020 09:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584032142; cv=none; d=google.com; s=arc-20160816; b=XDNECXKet+tACUQ1KhRgcrzVAlUyRJPusV0SdBT0n2Tha/99yDQt+gRgLzqoFagcYD gZfk7PH71fc1vmwNyIuQJGLnyNhUh4cZ152cEA5zX2UV8O/GuGlq5O6Y0YnhCaz03p/p tSTgRqkmLEF7AcR79XyDN8hbSCTIYuNjUjqyBAxuPol0P1JCHAEugbWi63AalH266zV1 WsG9d36YxTKEdrV2kM8EYsRxj9SdlHeutxiAe0aYTe4Xgure0p/YCnlafVNQmnfRKSnG zrdqGTwfbRhhDGyjxMAcfMCXfVnAbOP2J8c34kXKlXSkzoIGYKRFVn9Tk2zwCNuMpkSz 160g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=SArDM61DxsV/GfIWell/Cxt1WwRsKAiACjdjeXTddrQ=; b=P+si67dd6SURLOoKAAaGEvY1EVQsi1yCLhPMfTbEhxXiq/kyqs0DfVUKvXtAYYpPTJ dmFRKiMWl52t7n0oOk3UNdS/UGjdPpJheSPQJV0JsJ8ghZzmgwQE8UryjqW3fdeMCYBF ujAGf+pEfFXMjtJbeYvRZu8jsNpcUYYORFxeEFgEkvtSuYRYobKmVDIdcIytekSDTk0G VM3tAe6ZwYJKGxlnmtJGqoaRzt3oMk9gjpQ++FoFS4kdOkShEZa4Q7LOGXgaSAQMVwgQ EoP5be+4HA7HGK2ItdpSm3lvmM/+LzQ4ciMhB3/nW7y0/5JEzdsg8jVtn5jB/beIAo+k c7xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xdfkgIKD; 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 c80si2612475oib.276.2020.03.12.09.55.29; Thu, 12 Mar 2020 09:55:42 -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=xdfkgIKD; 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 S1726385AbgCLQyl (ORCPT + 99 others); Thu, 12 Mar 2020 12:54:41 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:39459 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726085AbgCLQyl (ORCPT ); Thu, 12 Mar 2020 12:54:41 -0400 Received: by mail-wm1-f65.google.com with SMTP id f7so7151880wml.4 for ; Thu, 12 Mar 2020 09:54:38 -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; bh=SArDM61DxsV/GfIWell/Cxt1WwRsKAiACjdjeXTddrQ=; b=xdfkgIKDq/iyo0jVzHfWYkFQBzAhD+amF2xVuFZiZuPFBLkNKlPqzVR/U4w6ISbDy1 34r7Max0IjBk7BZbBcrlubWi4PBD4s2cJ54a9tHl+X9eb+SLAiKZFIApKq9q7Eh3PjeU dWmyrehxec3cI3q2IhUjBgTf0oQqxWr+jvgHI+XUM5rz104CVwxX363QqpEHhRRegATb 37YRG45gRy5fMwn4BNhGSwEfocGasGpwFCfFsSe7sgs87+l1KUbeZgPzul+244z+5WOK oT3MnAXNwMSpwMRG1s4OJhRMGQY/HBEBvoWPzIP4TGJHbph/UU3CFy9c1YW/CJ3Rm/uo O8Rg== 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; bh=SArDM61DxsV/GfIWell/Cxt1WwRsKAiACjdjeXTddrQ=; b=rmivPA+NwpoX/a09HaDVvh7q0iemocNG8UjwUbgjSkd2NkGHfQ1++557UVL00L/hHx O/S30dE7e4QJURYfQgwXYP7eFEATIZnPfd/yBUJEgxoFWkYTPPDCXH2HsFxbtQ2HhpzV pzIDJUN/cWgrA6tpdketUx5un6UzwMVaoa/TVlwJXTMGWqi/mY5YGpjKOeIrNLXZKs3t WwSnM/4bcsL2g6AysucWhmEwPa37t2MK6GGAY16YovrR7YnQ2Fud64H0I68x3Ap/h6We 4rdsey8qvOEvVlC464CV/yb71AO2U2G/LkqESimm+pvKDWM/Ai7LwY/1VwpxeKZDk/x/ bEqA== X-Gm-Message-State: ANhLgQ1sxkfZfG6ZlL6OwKBXxDkVcvM5QwYMH64FgwLS8GKZFEWf6Z45 3HnOasj8Fw7V9AC6s6Ah/CQx2w== X-Received: by 2002:a7b:c3d1:: with SMTP id t17mr5649753wmj.27.1584032077771; Thu, 12 Mar 2020 09:54:37 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:e531:1d0b:d2d6:94d6]) by smtp.gmail.com with ESMTPSA id t81sm12818786wmb.15.2020.03.12.09.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 09:54:36 -0700 (PDT) From: Vincent Guittot To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, linux-kernel@vger.kernel.org Cc: Vincent Guittot Subject: [PATCH] sched/fair: improve spreading of utilization Date: Thu, 12 Mar 2020 17:54:29 +0100 Message-Id: <20200312165429.990-1-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- kernel/sched/fair.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 3c8a379c357e..97a0307312d9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9025,6 +9025,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; -- 2.17.1