From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5949EC2D0A3 for ; Mon, 26 Oct 2020 14:57:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1657322263 for ; Mon, 26 Oct 2020 14:57:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="D9Kko86w" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1782766AbgJZO5Q (ORCPT ); Mon, 26 Oct 2020 10:57:16 -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-Google-Smtp-Source: ABdhPJwc1n7JM8fZBxOp3v96LygjYE7dZmpo6zmmkl4iXWC7QHIjblXt8Axw+TmQM/GZzleczQStTu5zjtPB6P147K0= 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.