From patchwork Tue Oct 2 07:26:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 147956 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp4826916lji; Tue, 2 Oct 2018 00:27:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV63YV8d7/2SEFfYzTrOXbILCaFB9jSRrcC+4vH3Vr6le8OwAeyuFtmnfbB20UGK4QD/+dYKD X-Received: by 2002:a17:902:28a8:: with SMTP id f37-v6mr15374517plb.264.1538465222177; Tue, 02 Oct 2018 00:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538465222; cv=none; d=google.com; s=arc-20160816; b=hsuhqJLTvRANmILofqbfm2SANcTtN80hZwqZ9Ypjms++Q6mZd4pi7as8CsJ+AIvnVi pWYlzUrd+Hnjehge12fdYQVDdAleR7fSkuttDYE/QnjnPaS+TkxYL/Y3r4kera82NRfd T/Z4o8gJBV4UF4KSSFeywzNddNeKSKnLmiHtNRhQ5w1nzdwo5vUZWj+JfC0WjcltESam Ju3996cHxclQdMo66U6jr4MEATEgnJ9Ujs+daTvhQdYQZjIiFe9mmIzobulUIeIga5n4 U4qvmtkxTCK1ungXCgEtoHshiMgMe5VldlR6x7FVPqKzPYU8COh9ZTQ6Mx/iNQAKdsLl URKg== 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=8+letnrUftggUuNnWV9VjgurJvKNvmDW3KXCaTcLkec=; b=zSrLLEfN+6wE5CM+qLUiXb5EkGf7cLvrwuAK7M6ZIKLhMtGpRAIAE6rpiNVuT9cVhR BhnlITq8QnImmP4EALW13hrP/vNUr0XwuL+Z3Hs0Ot/j85GN4RhtTAC2EI388IPDzUbD bMgDnZ1+VKgsiEpW+TKzke2VZggkA6G/tFPGfyMCvDxM0iF6Yg0cZOomwsGNklErNatc Ied9DVuZOW4xub0DinnyzWxCffz94Yao5hjSSpABF0uwA/yPoYBwYBXzgIy4vDbYIIjx KJNiJ2ibgbED6M4OU95ivIe/0Eka+5yupTuncAnusDU0QRJ0iF6ukYiEqDaOPUtbSy0e 0Ozg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LIqySdi/"; 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 d5-v6si15253345pla.439.2018.10.02.00.27.01; Tue, 02 Oct 2018 00:27:02 -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="LIqySdi/"; 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 S1727033AbeJBOIt (ORCPT + 32 others); Tue, 2 Oct 2018 10:08:49 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:43319 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726787AbeJBOIr (ORCPT ); Tue, 2 Oct 2018 10:08:47 -0400 Received: by mail-wr1-f67.google.com with SMTP id n1-v6so904564wrt.10 for ; Tue, 02 Oct 2018 00:26:57 -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=8+letnrUftggUuNnWV9VjgurJvKNvmDW3KXCaTcLkec=; b=LIqySdi/hQNddNF7iZF72vB/x/20T8hK6twDHDrumNqp/ltArrhJ3cQcFcC8yw7KWS rif+//CB/1/GhzGpa3ROaKUYK9G9DqcZdk9y2oTaFhX1t4Iemf4scpLwntPc58mXV4Ss mHQYIJbfMOU2FDfA/IutuJuoogKaVBzftKakQ= 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=8+letnrUftggUuNnWV9VjgurJvKNvmDW3KXCaTcLkec=; b=suk7hiG4hBaPBMnREVncOm2pd8JX2fN4csiLCzS2fQ7u29Bxq0BuIdvIO+DM7SZ4xu vh71jWEgALvtaWsNjvjsc72S5p7ZcbES+SRhbonda1xCRaBlSFU7gX1srjRZB8460v7Y Dl6mVkhIzyDaueWbQeAByaRluheXXZwkE35B54B2d1k+ilfwHlGJg/CgXwbRW+kgR9Q7 g2ZLPkt1QzgQWUu9YJhn/XSaShbz52kMRuPrLqztENvRRDtYOiCvl2sVeYuuAxcLyS0p TxYoUFft+bZCOEABlLagKeuPEj6XUtSPYGHep5tqeXS72EsgQuHUOXMOotykzX3EIk3j Qd0A== X-Gm-Message-State: ABuFfoiBLDqXASC8ByC0hz9+6oXOKTcpH1FOW8XxLGB13o74kBc5313B Dl1y3qYa5hj6oVsP+mfqpxcQK7atNF4= X-Received: by 2002:a5d:5002:: with SMTP id e2-v6mr9954337wrt.210.1538465216390; Tue, 02 Oct 2018 00:26:56 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:99b3:4272:8254:6430]) by smtp.gmail.com with ESMTPSA id t24-v6sm3550552wra.5.2018.10.02.00.26.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Oct 2018 00:26:55 -0700 (PDT) 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: [RESEND PATCH 1/3] sched/fair: fix rounding issue for asym packing Date: Tue, 2 Oct 2018 09:26:37 +0200 Message-Id: <1538465199-20176-2-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538465199-20176-1-git-send-email-vincent.guittot@linaro.org> References: <1538465199-20176-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 6bd142d..0ed99ad2 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7824,6 +7824,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;