From patchwork Fri Dec 14 16:01:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 153886 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2236212ljp; Fri, 14 Dec 2018 08:02:11 -0800 (PST) X-Google-Smtp-Source: AFSGD/XMrvl3bgBxij8c2icNa/fmdQgi2FSEzfzfy8x7AldSt+HcCRtrfvxTSWxnCwNcAn4XZeGz X-Received: by 2002:a63:c00b:: with SMTP id h11mr3209525pgg.429.1544803331323; Fri, 14 Dec 2018 08:02:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544803331; cv=none; d=google.com; s=arc-20160816; b=XvDlYkU8NlQX7HonrFQCP1jrXufwncZ5GplAYW6x4Q3SLmxXRW2JRcNO2FXntC0jJm jlUKxzncBrQwu6VkniVImEaDsVdRDy9P+48JtA4pHDiU2R7u0tBzUwP80lY2Gwa6SuYg LEauB6jWOb06zI+aR+mDrBoBIqbyHWi8knS4Wfa5bP+GVBP0+dHcS6Hvih7ot7AiP/hs +DfqFcHpNIbAAzpLx5LursAfhkkW6RAlSfLzWukmZ2CTZesn/eTrFAcptMUKFyEkjTi6 vHA3ot0eaQy6uYsRf8JqLw2ZE0qp6Sf71C45IINpb1r3taBKyia5L0aNZDPYf/MGL4di Zklw== 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=BfiRUdDr+TqI7TV0rLeVcx1oIP63u9FOItmohRxuqAU=; b=uSa/2kHXNn0PvRzOuyMm1dYvAcLsYRxBCKBkFwmVMPXtMzfjem6cT+aZRqO2qCRx3d WQzo5auwi7SqNgYw4K4ItICGmxT6zaONsdsxkvbPcQe47/sP3BaHRTTd67psxTbQyHg3 3wq7e9t5YBNeXVya1qJ2LZIoskw8VThpO6+McMhN6XZO24jXZ8PIG4b9INBGuQrs8Q4u koYJ03t8UZ3xcWF2V0VsddeJt/C26UX0k3QNHAnrcLOdIUUS8O1YCwwN/ns8NAnE2AAF cjvHAUU1dMfGLQ7BUNHNXKvlp83AYECshqer00gq34jPCH60PN2bJeaTX2kZztXCQeQ6 vbqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SaxsDPQG; 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 i16si4188182pgk.445.2018.12.14.08.02.10; Fri, 14 Dec 2018 08:02:11 -0800 (PST) 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=SaxsDPQG; 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 S1729469AbeLNQCK (ORCPT + 31 others); Fri, 14 Dec 2018 11:02:10 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:40713 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727872AbeLNQCH (ORCPT ); Fri, 14 Dec 2018 11:02:07 -0500 Received: by mail-wm1-f67.google.com with SMTP id q26so6269055wmf.5 for ; Fri, 14 Dec 2018 08:02:06 -0800 (PST) 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=BfiRUdDr+TqI7TV0rLeVcx1oIP63u9FOItmohRxuqAU=; b=SaxsDPQGDfyKGuUp3x6n0RHJglokYsIg6NYMmkUqYEW6KdsjrgVW6ezqfb/xpSnZbj ih07cayFOVLuU1Dk/B2IgGZanbTS434FjwfpahfWihQt4ICdMhF74RxvCvWTRP1gjbUj zxqCW8Inz+/sijvUmdczcLYjOeWZxAxjJsYAs= 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=BfiRUdDr+TqI7TV0rLeVcx1oIP63u9FOItmohRxuqAU=; b=lkbCaKSsk5sYbN3h3jJKoziRPxMdMv4dovxe4RPQmuwgLLY/pqqbtTqLbpkrR4S/Uh ksXRkQekJzSaUnpTN2a7UNq7L30xNk+kr+8wC9NJdhXmGLBzl37Xd/K3mKl6PO4jHuBE fu28ogBKY1hTDZ6JdNhfm+HU+Pe1Fs/EApNjtJ0YGtSG7Gys0wz5HGP63FVxqfBmxnlK Z+ygrUVxAJGhxELPLyHd82fgZbNCm8f4r4RUnTNCyiNz03HXdhPIGcArMJLFHR7DuXX9 OLlnK7N68F93OdUirdxCo34NylAHUA5JgR5sEhW4m2pgYPJK1FwYWmQ3t9klDVuZPgvi 2/sw== X-Gm-Message-State: AA+aEWYl0zHehv2dtsb5mjbLgiseonGeOdBNQMw4wbZejXM86obF9sSA K8ofFmcFmn5R8C90vSLrDW+X2Q== X-Received: by 2002:a1c:c2d5:: with SMTP id s204mr4008104wmf.144.1544803325423; Fri, 14 Dec 2018 08:02:05 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:f:6020:ed2e:a6ad:f6ef:ff8e]) by smtp.gmail.com with ESMTPSA id e17sm7888738wri.36.2018.12.14.08.02.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Dec 2018 08:02:04 -0800 (PST) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org Cc: valentin.schneider@arm.com, Morten.Rasmussen@arm.com, Vincent Guittot Subject: [PATCH v2 1/3] sched/fair: fix rounding issue for asym packing Date: Fri, 14 Dec 2018 17:01:55 +0100 Message-Id: <1544803317-7610-2-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544803317-7610-1-git-send-email-vincent.guittot@linaro.org> References: <1544803317-7610-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 When check_asym_packing() is triggered, the imbalance is set to : busiest_stat.avg_load * busiest_stat.group_capacity / SCHED_CAPACITY_SCALE busiest_stat.avg_load also comes from a division and the final rounding can make imbalance slightly lower than the weighted load of the cfs_rq. But this is enough to skip the rq in find_busiest_queue and prevents asym migration to happen. Add 1 to the avg_load to make sure that the targeted cpu will not be skipped unexpectidly. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ca46964..c215f7a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8215,6 +8215,12 @@ static inline void update_sg_lb_stats(struct lb_env *env, /* Adjust by relative CPU capacity of the group */ sgs->group_capacity = group->sgc->capacity; sgs->avg_load = (sgs->group_load*SCHED_CAPACITY_SCALE) / sgs->group_capacity; + /* + * Prevent division rounding to make the computation of imbalance + * slightly less than original value and to prevent the rq to be then + * selected as busiest queue + */ + sgs->avg_load += 1; if (sgs->sum_nr_running) sgs->load_per_task = sgs->sum_weighted_load / sgs->sum_nr_running; From patchwork Fri Dec 14 16:01:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 153888 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2236362ljp; Fri, 14 Dec 2018 08:02:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/V9T2NdQ52Stqp9ZZo/2iZYMkDNmSVuHQyeXXHqugm8cKQMdfwud/nEg4IdVigH+3W75W/m X-Received: by 2002:a63:e915:: with SMTP id i21mr3063045pgh.409.1544803338239; Fri, 14 Dec 2018 08:02:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544803338; cv=none; d=google.com; s=arc-20160816; b=rEipmr2YEIc1SZGy4knV54OsgHZDmhJJwvWspWKGM4LJsVPtGH9IH7jPiotD4X04oD bFkNUPV7W19o2ONhsogStrUkq1/uKvH84y9peBRB5B51muWZa0/HOCPBbBFbSKESKeqq 90vZOUOJzKztqP4GlKFFRk+PpChbbMcw6x+H0LYnFfwHrQnRmho+Cu66Jd/sENfEpUZV c9o356l7LH135Ucj2cnTrZh5bj1kLejucA0RMeoDZeUJR/bTmJnDNNlXFCnJ2MKKxa63 kwt4gSu2ZMGMYKtUWWkofrK/lrCO5Xxby0KCntYRpbvLNb3pLGWuXZgbM/Jt4WJozM0P +NaQ== 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=bEsSijZyC8zHwK9eeXI5Xlit0fDMhlGIwei2/4qKE5U=; b=QUbt0uAX2Es0sojVqUumeErGa78Hx1XJBJ2sM2Tez3StCf5SUy4h+N9I4PFzuc+x/3 RG7L3SomGepDdSyzzNg0KCec4pGJ6J0QxBEN9zDKD9hY186VxvO0pN57+zHMJvUXI3M/ gmSTW2+vjXzmFZl0/xsk1V/TwDR/O8Ml37Z4OTcZ7mDkqPo8lfiOn3/Xi7X2Ntqp4qBR r6+3IOHwBKMvEiFjjVIXINbJga+dPnMyKwqMh52Hk5ee2g0Yregpj1O5ysLm8HhOd1ji VCS8L2ZP9au1FrWjBb51p2/qMrC6cOHIbnAu2b94qSQv8LRwEFsb4yGlvOsuY7Jn9SV4 Jz+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fb2pJjke; 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 133si4640426pfw.64.2018.12.14.08.02.17; Fri, 14 Dec 2018 08:02:18 -0800 (PST) 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=fb2pJjke; 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 S1729641AbeLNQCM (ORCPT + 31 others); Fri, 14 Dec 2018 11:02:12 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:44456 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726510AbeLNQCI (ORCPT ); Fri, 14 Dec 2018 11:02:08 -0500 Received: by mail-wr1-f66.google.com with SMTP id z5so5910665wrt.11 for ; Fri, 14 Dec 2018 08:02:07 -0800 (PST) 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=bEsSijZyC8zHwK9eeXI5Xlit0fDMhlGIwei2/4qKE5U=; b=fb2pJjkeqFw4gsOmDX2q3ZBWp+kyZrEWa3zh2f5JCrV4xrawRuMRAMOwX7Cv27iq2d WoKOl1wWuADauCD6inwCoGnp8WlRQmsT5Dwj+zKFj6vW4+yxHpoQ+T85Au5Y9LOAo6wS jG1gUx7otTmGq9rfG7MWhgu9pdZOK+BCC0qPs= 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=bEsSijZyC8zHwK9eeXI5Xlit0fDMhlGIwei2/4qKE5U=; b=On9p7VR0nQU78YNYYC8DxpYr5GDPeM0Tl1+5Pd2IBhDj5KwRiT4Zrx6euG9KH53Bvf 5YRiSU93YaHnX+T6vkXTFSyjwgmASqssRdRTEiJERifmqqK2Oh6PFuFxO0os86P5aNa6 SjmjkTY0R+3iwunJftrEOS/jftuQn1drWHCCIQn2b/yEgbAY/ZVQnNw1lm4qt6EKHUTu ZU+j8fhVkFybVTzS2Ex/COq865bRtip0EVDUydwBLfQijcoqlu6Nmvz+Yr1N6b/31X9B PQD+RSAUeP2o1bakV/0bRGmm4BAKEhe4lwS1vFwpUEgsL3Wy9H8wgHqWw3fBuuvAiV3h 1PgQ== X-Gm-Message-State: AA+aEWZ1JZKOrPkOIukdQMaN3hu9inemEt9BvO/uZDr+U+pyCwWWCZPU SMJg7YMvXVdjdROid642pH25gA== X-Received: by 2002:adf:fd87:: with SMTP id d7mr2958962wrr.74.1544803326747; Fri, 14 Dec 2018 08:02:06 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:f:6020:ed2e:a6ad:f6ef:ff8e]) by smtp.gmail.com with ESMTPSA id e17sm7888738wri.36.2018.12.14.08.02.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Dec 2018 08:02:05 -0800 (PST) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org Cc: valentin.schneider@arm.com, Morten.Rasmussen@arm.com, Vincent Guittot Subject: [PATCH v2 2/3] sched/fair: trigger asym_packing during idle load balance Date: Fri, 14 Dec 2018 17:01:56 +0100 Message-Id: <1544803317-7610-3-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544803317-7610-1-git-send-email-vincent.guittot@linaro.org> References: <1544803317-7610-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 newly idle load balance is not always triggered when a cpu becomes idle. This prevent the scheduler to get a chance to migrate task for asym packing. Enable active migration because of asym packing during idle load balance too. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c215f7a..9591e7a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8861,7 +8861,7 @@ static int need_active_balance(struct lb_env *env) { struct sched_domain *sd = env->sd; - if (env->idle == CPU_NEWLY_IDLE) { + if (env->idle != CPU_NOT_IDLE) { /* * ASYM_PACKING needs to force migrate tasks from busy but From patchwork Fri Dec 14 16:01:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 153887 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2236270ljp; Fri, 14 Dec 2018 08:02:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/V4rE0KLUKZKsOTzifOhPJGZI6JxTZkba52LEYh3uM38mbPN6yfJr7epSLpvPmo9lFoOLMU X-Received: by 2002:a62:5c1:: with SMTP id 184mr3302876pff.165.1544803334010; Fri, 14 Dec 2018 08:02:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544803334; cv=none; d=google.com; s=arc-20160816; b=OdLUCgQwKJQKdwKcR4kblOWwI0qQNn2JoQ2IJYfwXEKEmVsvHOVzU1l01t5fgnHclc luhc8GJaDDcCZxMCq+4dx9oSJUeNedc0JWG+QGH926/O0dMyhtIn/1ZAime7b2ne6x0P FDf2G/pD5LvQCRi86bkQALfd6yXM3EW6UeSY6Olv2Eh+edmyO4tVHqSeMbtzWiJ+PBlL 7iIW0qyXcW72RIlHJq/uRwHHOGAHaqRDNHBElAYfKvu301Ryf1nVbjue03YdN/7PvgZd F/TqkRp207XT2IEtsS4P1qqI844K/ikVrCkgC+5inNTXvB4eVwOfZpoMYLNzIHu97GEB bhlw== 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=kSbUmE3EGKEapXTs6bs0NCt+NOaZjSpHnZY2OS9OQMI=; b=QOuchB5WHuJURckPM48f61zF3yIYdXOXnSmVCF+zjNA6ywYfT+bis5yXezYpUPnq11 LvFPN3U5AsiAl7SWDcRW6do1TksPa369qcnFiuOCAAfjg9N1/Ujphkj3SpgE4ScgWgWU HKMEafkHMgd3UkA/X3vZ3gNq3MnquxXju7EFQV3eZOsPlE/mHcnKKqgUrPnvFk8Li8sy HnPdMYXeYunJzBbOaEnbCvT5V+jr33NZKLq4okJMU+ch1qnRiNjb2Y4GrStd1hFX/OQZ 47q2gN4wcn9grfD1l+b0af8c+TsdJs7C9IAKahMONSGFuWnClvh/7eEd99uAeEUQbQ9F t3vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=havscmDW; 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 133si4640426pfw.64.2018.12.14.08.02.13; Fri, 14 Dec 2018 08:02:13 -0800 (PST) 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=havscmDW; 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 S1729749AbeLNQCM (ORCPT + 31 others); Fri, 14 Dec 2018 11:02:12 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:45571 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729223AbeLNQCK (ORCPT ); Fri, 14 Dec 2018 11:02:10 -0500 Received: by mail-wr1-f67.google.com with SMTP id t6so5750516wrr.12 for ; Fri, 14 Dec 2018 08:02:08 -0800 (PST) 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=kSbUmE3EGKEapXTs6bs0NCt+NOaZjSpHnZY2OS9OQMI=; b=havscmDWwZGMAzKt5wuIleD+HFomPrfW11OQVCs5Gs6Z9+OvpKXIkYwSNhbFiiAuQr HcvAf5tlFEPY/VY55VCrgOhPWoPbwzex4ruA8Ui2KaBgfmOXMvU272J/S5C1I+4MuoE7 DFEFwD8jgxaE0oHhgW0KDi2R9azUbbBJ9LWQU= 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=kSbUmE3EGKEapXTs6bs0NCt+NOaZjSpHnZY2OS9OQMI=; b=GjYJjf0NOLHtQvCVCqoq05C/rRs5yG49Ncc0rmQ/wkHcXEY7wiR/cd5ZJ9ESDhb6/j X8u+kBHXN05EWygX5eoLBgAKP++hA6hH23LYsYSM6RHOQqXImylGh8oDspqDrunvZNNU j13mkAI7LH26K2dfnSj4YfVJ3aFXFEq/fROu2tL4+LPAz5NuNsF08MKRx+2lFV//zgxL C/LZDxm+AYoSeoeYv8pnN34eHRSxgDYVv9sKtpCGoqZeDU73N06HKd/jLerSU5j2ikEA 1apJf1/ymEXpc1pA6eSirEvySzQyZVTKGtU414NIshIna80lJo1TAzCWaaMeNLesC/2P 2Ihg== X-Gm-Message-State: AA+aEWbgD9IUYxYhqznnkyPkmuogHhubtTVq+IkCeHmHTwzY9zINTCjY OKRpb8NKLlONIpgc6hFa9+wnyA== X-Received: by 2002:adf:c108:: with SMTP id r8mr3195463wre.233.1544803327999; Fri, 14 Dec 2018 08:02:07 -0800 (PST) Received: from localhost.localdomain ([2a01:e0a:f:6020:ed2e:a6ad:f6ef:ff8e]) by smtp.gmail.com with ESMTPSA id e17sm7888738wri.36.2018.12.14.08.02.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Dec 2018 08:02:07 -0800 (PST) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org Cc: valentin.schneider@arm.com, Morten.Rasmussen@arm.com, Vincent Guittot Subject: [PATCH v2 3/3] sched/fair: fix unnecessary increase of balance interval Date: Fri, 14 Dec 2018 17:01:57 +0100 Message-Id: <1544803317-7610-4-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544803317-7610-1-git-send-email-vincent.guittot@linaro.org> References: <1544803317-7610-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 In case of active balance, we increase the balance interval to cover pinned tasks cases not covered by all_pinned logic. Neverthless, the active migration triggered by asym packing should be treated as the normal unbalanced case and reset the interval to default value otherwise active migration for asym_packing can be easily delayed for hundreds of ms because of this all_pinned detection mecanism. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) -- 2.7.4 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 9591e7a..487287e 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8857,21 +8857,24 @@ static struct rq *find_busiest_queue(struct lb_env *env, */ #define MAX_PINNED_INTERVAL 512 +static inline bool +asym_active_balance(struct lb_env *env) +{ + /* + * ASYM_PACKING needs to force migrate tasks from busy but + * lower priority CPUs in order to pack all tasks in the + * highest priority CPUs. + */ + return env->idle != CPU_NOT_IDLE && (env->sd->flags & SD_ASYM_PACKING) && + sched_asym_prefer(env->dst_cpu, env->src_cpu); +} + static int need_active_balance(struct lb_env *env) { struct sched_domain *sd = env->sd; - if (env->idle != CPU_NOT_IDLE) { - - /* - * ASYM_PACKING needs to force migrate tasks from busy but - * lower priority CPUs in order to pack all tasks in the - * highest priority CPUs. - */ - if ((sd->flags & SD_ASYM_PACKING) && - sched_asym_prefer(env->dst_cpu, env->src_cpu)) - return 1; - } + if (asym_active_balance(env)) + return 1; /* * The dst_cpu is idle and the src_cpu CPU has only 1 CFS task. @@ -9150,7 +9153,7 @@ static int load_balance(int this_cpu, struct rq *this_rq, } else sd->nr_balance_failed = 0; - if (likely(!active_balance)) { + if (likely(!active_balance) || asym_active_balance(&env)) { /* We were unbalanced, so reset the balancing interval */ sd->balance_interval = sd->min_interval; } else {