Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp515741pxx; Mon, 26 Oct 2020 13:59:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJmcC1ljLq6FJHFpypZX+ViYrzAFNaCuuU5pgnV9y/EhctebTCgJoEeNJGu400o1vaS7ST X-Received: by 2002:a17:906:3406:: with SMTP id c6mr16646328ejb.65.1603745971111; Mon, 26 Oct 2020 13:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603745971; cv=none; d=google.com; s=arc-20160816; b=vBx7uctH5LgG3+QLR8joinBJAcz/VtrfTBqf1Wa7HYWFYNhmjwIp4e4r8FpoQuIvhC ZMiJKQSd3KNLahAY7woeHFzNKtFUT6tMzueLZFXiGfJA6olHMar1ouWv6u2IoDqVwr/7 e+rkCBA+ZYC+s0nY5LA5UfHnRAS7tMRdDxEov2ZdYCMNodNxumA6Z6KYVH9AvTwuavlM CJwtLUF/z5SFRPx4GknOnXgy5uMyQGKwcJyWq8nZtEJgBF9FMy+LE6PVUNQMy4ehQxyz RNwVIhp4aI6RVg54lBKec+Doq5W7unJ+Q7UyjsWiP+vde+7skwYcCGq+DDsbNBiD70Z/ 9fAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=pSA+DGoeMH5QnkmEccBSTIE7Gf8PQfxGpcU7YSlI3zA=; b=UydjtBkQTmB6Rloo7+E1/GXhOU1Sr69slGUzegyfVoXqn+4pvunsC05iYkuGni2oPo COQxb3YtD6xtBMVYrQV4U4p9KGSQVNNpffrG0Cmdo8Lhf+vaEtAajJKY6H27lKocAmTd AXRpma0oKwwgB1TSU9TWA+d/i7m/OwycwvRosPSQdTOYKJ/A2AlfIZHak9SXgfsvwK4h SZcGGBM/HpDkXzSDu6Sdt6oNWEHRAinpOpeoxAR+xv4UzTRomUy3UtVslEGWJXKJ497n 1urSyxhhgWpY1eUvTIKqjSxMw33dDYNx8vj5Alrrs6J2c+WBOi5U6Lj/rWN87GjQm7u8 7syw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si1769123ejb.287.2020.10.26.13.59.09; Mon, 26 Oct 2020 13:59:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1784890AbgJZQEy (ORCPT + 99 others); Mon, 26 Oct 2020 12:04:54 -0400 Received: from shelob.surriel.com ([96.67.55.147]:55606 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1774040AbgJZQEx (ORCPT ); Mon, 26 Oct 2020 12:04:53 -0400 Received: from [2603:3005:d05:2b00:6e0b:84ff:fee2:98bb] (helo=imladris.surriel.com) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kX4zF-0004Ss-JC; Mon, 26 Oct 2020 12:04:45 -0400 Date: Mon, 26 Oct 2020 12:04:45 -0400 From: Rik van Riel To: Vincent Guittot Cc: Chris Mason , Peter Zijlstra , Johannes Weiner , linux-kernel Subject: Re: [PATCH] fix scheduler regression from "sched/fair: Rework load_balance()" Message-ID: <20201026120445.6a5dbbbe@imladris.surriel.com> In-Reply-To: References: <0014CA62-A632-495A-92B0-4B14C8CA193C@fb.com> <20201026142455.GA13495@vingu-book> <465597a2250d69346cff73dd07817794d3e80244.camel@surriel.com> <334f491d2887a6ed7c5347d5125412849feb8a0a.camel@surriel.com> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: riel@shelob.surriel.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 26 Oct 2020 16:42:14 +0100 Vincent Guittot wrote: > On Mon, 26 Oct 2020 at 16:04, Rik van Riel wrote: > > Could utilization estimates be off, either lagging or > > simply having a wrong estimate for a task, resulting > > in no task getting pulled sometimes, while doing a > > migrate_task imbalance always moves over something? > > task and cpu utilization are not always up to fully synced and may lag > a bit which explains that sometimes LB can fail to migrate for a small > diff OK, running with this little snippet below, I see latencies improve back to near where they used to be: Latency percentiles (usec) runtime 150 (s) 50.0th: 13 75.0th: 31 90.0th: 69 95.0th: 90 *99.0th: 761 99.5th: 2268 99.9th: 9104 min=1, max=16158 I suspect the right/cleaner approach might be to use migrate_task more in !CPU_NOT_IDLE cases? Running a task to an idle CPU immediately, instead of refusing to have the load balancer move it, improves latencies for fairly obvious reasons. I am not entirely clear on why the load balancer should need to be any more conservative about moving tasks than the wakeup path is in eg. select_idle_sibling. diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 35bdc0cccfa6..60acf71a2d39 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7415,7 +7415,7 @@ static int detach_tasks(struct lb_env *env) case migrate_util: util = task_util_est(p); - if (util > env->imbalance) + if (util > env->imbalance && env->idle == CPU_NOT_IDLE) goto next; env->imbalance -= util;