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 {