Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp257514pxx; Mon, 26 Oct 2020 07:59:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzu7hskUwsQ3S1vKTv+YN8FVjDBoi7GA6Rq43/OifHnMAeigDpo/pX5Ds4BNBt4YY/2ytga X-Received: by 2002:a17:906:3e4b:: with SMTP id t11mr15606424eji.420.1603724373197; Mon, 26 Oct 2020 07:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603724373; cv=none; d=google.com; s=arc-20160816; b=HkeMr+c0BemBx9V38VDg9QMCL2KDoO1Sx49wx+TxYHIiTYSDqsfmx1zEMtNWHB/k/6 dkTJ5UZYilPrFoBxvYNcW+o1uApfKdPwRXzugB7RhJUaRtbSXL9OruAfLDW3LNQl8/Zl HE27xObdU3QbnKZ396JmyYYhrhnqvXFL299VbwzH6zqCKMfo9DQBMT6TdPyLDG6nApb0 I3wTs1VY76O+eCFjP70rz70jM0e/p7z01tTZISY7YUfUrXB9/g4qChEjTGWQ3ZcIRl2Q tzyY6w/ahR8olc34kJDljZkSCg+D3p5eJ9qUHVnjW5r9/O7x+MnK+K4Z+HQ55Qwac9gX EtqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=AY1upMRPHFh+EW7yKRAkdO69ELLWbe4gw5pBY2cxk6s=; b=NTPEUZ1Cu5rY3v1LJy5UD3eOR3l1vmcSNEWMkcVirasFdDUfx7oiHnVV7qqWMjcS0R JplBQ+8GU47jeNMGt6OsN7l9//DOk7pgwAt8SM6BpZ+OT6fRXWcXlkcrZc789nHDzcaH krJ3yKE+Xlj5t1aZBx6GAJaVxVdRoRlXRPgMJtJpZ/4ohixFSlrCf2DpEU4xNzi0OohQ V+hH9mPxy6qYNa+tkN4QaxbX0RcBG7xERjZ/8W8XnVY6kjL96ZcO2gN1GnHVC/OxWEJp A7fjNkni/76bA0wkavYbbvQOQ4bf2sB91BTN/1ChisG1GVm83Jwd+V0ONeJTJmeAd+gl p6zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D9Kko86w; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c21si7621743ejr.483.2020.10.26.07.59.08; Mon, 26 Oct 2020 07:59:33 -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; dkim=pass header.i=@linaro.org header.s=google header.b=D9Kko86w; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1782332AbgJZO5O (ORCPT + 99 others); Mon, 26 Oct 2020 10:57:14 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:34698 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1782217AbgJZO5M (ORCPT ); Mon, 26 Oct 2020 10:57:12 -0400 Received: by mail-lf1-f68.google.com with SMTP id z2so12487134lfr.1 for ; Mon, 26 Oct 2020 07:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=AY1upMRPHFh+EW7yKRAkdO69ELLWbe4gw5pBY2cxk6s=; b=D9Kko86wO1ttI/fVOr7v2knDtTaUlZGkmjlWzvOjqYf3FmvKeeNM4kpXxLHSEXB5WR AfeJxGyLY4+blFUSGJhIaW+WKWXt4LVZozwR99H6jgFyv37T9MLdVm5gvaDEeoz4nlqt QND10MFbm2EFTgLLbhS3EwHoQFISHcDBH4B4KFhcPvSanJb8qLTatt+9MIZ39PgVkA0H 5i0zux1NLV2B65jTNmB4GNRtmWdxsNMHgpems3UOpHiAr48YB9X5WYZ+luqOaRNlu/gd odR91di5I0DJK6yZa0FPBEziB9m81chmdxD+MWckpFHYYD0bBw/okgjsRMSaSm8pYWVt IWow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=AY1upMRPHFh+EW7yKRAkdO69ELLWbe4gw5pBY2cxk6s=; b=ENqKzmSKNfH2jCbuhXYwsHcNRAGOwK5jmX/Dmb8ehtvOEC9GFaq6mnekVkcWnNPi25 As8pcMG1/hA9svsH0V/tl7ex6JJyK+5sqIT/mIYKhen06Yw3ti/rhBrbVz9kcznTeGbn 8HRkFdZ48/qN18lMg0zb+85uwxtLArcI3cLryUG45muNfJtltrnmjOKi/slErqqprJ8W v++hJKSr6jRzmFzouOTcCFHkLf7sg6nqoMMqjzDP8RO68aCDWp7oNRS6pE0BRIZ8F7U2 rZHxZgkbtQbksdB6SOGr0vNlNN7jr7niP6Bxz/IfHYVzZ63dMMDI8Hj1kOWgjdkAO14s vRCw== X-Gm-Message-State: AOAM53150DGu9s4GGtll9eSCMKQA3msT4363i3CaUqqMOcPJtAy4ot29 GFUvOQ4iVnweYOnZwoSPLk9cjTlpYQ+t459EMQGwTg== X-Received: by 2002:a19:d10:: with SMTP id 16mr4918093lfn.385.1603724229502; Mon, 26 Oct 2020 07:57:09 -0700 (PDT) MIME-Version: 1.0 References: <0014CA62-A632-495A-92B0-4B14C8CA193C@fb.com> <20201026142455.GA13495@vingu-book> <465597a2250d69346cff73dd07817794d3e80244.camel@surriel.com> In-Reply-To: <465597a2250d69346cff73dd07817794d3e80244.camel@surriel.com> From: Vincent Guittot Date: Mon, 26 Oct 2020 15:56:58 +0100 Message-ID: Subject: Re: [PATCH] fix scheduler regression from "sched/fair: Rework load_balance()" To: Rik van Riel Cc: Chris Mason , Peter Zijlstra , Johannes Weiner , linux-kernel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 26 Oct 2020 at 15:38, Rik van Riel wrote: > > On Mon, 2020-10-26 at 15:24 +0100, Vincent Guittot wrote: > > Le lundi 26 oct. 2020 =C3=A0 08:45:27 (-0400), Chris Mason a =C3=A9crit= : > > > On 26 Oct 2020, at 4:39, Vincent Guittot wrote: > > > > > > > Hi Chris > > > > > > > > On Sat, 24 Oct 2020 at 01:49, Chris Mason wrote: > > > > > Hi everyone, > > > > > > > > > > We=E2=80=99re validating a new kernel in the fleet, and compared = with > > > > > v5.2, > > > > > > > > Which version are you using ? > > > > several improvements have been added since v5.5 and the rework of > > > > load_balance > > > > > > We=E2=80=99re validating v5.6, but all of the numbers referenced in t= his > > > patch are > > > against v5.9. I usually try to back port my way to victory on this > > > kind of > > > thing, but mainline seems to behave exactly the same as > > > 0b0695f2b34a wrt > > > this benchmark. > > > > ok. Thanks for the confirmation > > > > I have been able to reproduce the problem on my setup. > > > > Could you try the fix below ? > > > > --- a/kernel/sched/fair.c > > +++ b/kernel/sched/fair.c > > @@ -9049,7 +9049,8 @@ static inline void calculate_imbalance(struct > > lb_env *env, struct sd_lb_stats *s > > * emptying busiest. > > */ > > if (local->group_type =3D=3D group_has_spare) { > > - if (busiest->group_type > group_fully_busy) { > > + if ((busiest->group_type > group_fully_busy) && > > + (busiest->group_weight > 1)) { > > /* > > * If busiest is overloaded, try to fill > > spare > > * capacity. This might end up creating spare > > capacity > > > > > > When we calculate an imbalance at te smallest level, ie between CPUs > > (group_weight =3D=3D 1), > > we should try to spread tasks on cpus instead of trying to fill spare > > capacity. > > Should we also spread tasks when balancing between > multi-threaded CPU cores on the same socket? My explanation is probably misleading. In fact we already try to spread tasks. we just use spare capacity instead of nr_running when there is more than 1 CPU in the group and the group is overloaded. Using spare capacity is a bit more conservative because it tries to not pull more utilization than spare capacity > > Say we have groups of CPUs > (0, 2) and CPUs (1, 3), > with CPU 2 idle, and 3 tasks spread between CPUs > 1 & 3. > > Since they are all on the same LLC, and the task > wakeup code has absolutely no hesitation in moving > them around, should the load balancer also try to > keep tasks within a socket spread across all CPUs? > > -- > All Rights Reversed.