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;