Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1426395ybt; Thu, 9 Jul 2020 06:53:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwr23oVR7CcEo+DYYQ1hYOD9Y8SA8utzuQ7ohRmUPoLstkGsK1GCzTXYWXWPf+0tRldCjUj X-Received: by 2002:a17:906:5283:: with SMTP id c3mr53512061ejm.22.1594302828372; Thu, 09 Jul 2020 06:53:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594302828; cv=none; d=google.com; s=arc-20160816; b=TbfWSjm/s2gfa/hGWVDD3v9oE6htYJ/sMuesAnZKoM5+9d5rU38mHS+lCQNSSebzZ2 9VWWm+q9vfxVm+w21dPjWYodUGa8+T/6n7NkE2UGlXKOFlUw3jeXd/3KC4gPL1/q6kif sg/s51fLvQS8rX/wohF0LVeI5vHLrxxEKJfR0EEaJNLqQUJhm5geXE1NwltYJqR967YW ETEalCwskKa07FUZLjqJuAN5PfiD61IgitM/40doxYOwvvY0w0g5KSTTY/nqBmtZTi2F QO8NyzKCtgtsdc2NuP8PwjArzmsnsNcCzipyHEbJ/T5ol8f0DSPMVgKTlvFjOAmCfCY9 6sZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=gGVuo8ujJimg/zW9016fI/nLusAS6eB6X5j2AJ72Jog=; b=ntdNSf5UOecB0T81xv883yruRW5MyfmeORuwCYIxnwvDdkAGb9L3npN9BCxEbM3lfU jt+AoZVxPxB4QUsMJpnfiL1szr9E88cDFKk46pI8QK2nXOgBLX7+oUQd6/Tn/l0ppvvP y9RhNlm5nlzZbVqc1RbEnSre1qIc2HwJqEe3MMJkUVID4TWX8ELDIf65cyO0zu8ZLHu/ +725I66VUyLE4J/1/LrFJV5O7DkORm7zzPX+wNLpfC+Qf9+mLoI4yNdVgDqjBT+8eNLF PQSqGhmRZAEOEtlGjEdi2WecMZXs35i6R+SjUQ4u5fR0Jvov+GBvtBp0iiS9fjr7CFD4 lnyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=npvFezMT; 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 re6si1969433ejb.381.2020.07.09.06.53.25; Thu, 09 Jul 2020 06:53:48 -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=npvFezMT; 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 S1727972AbgGINwn (ORCPT + 99 others); Thu, 9 Jul 2020 09:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726660AbgGINwn (ORCPT ); Thu, 9 Jul 2020 09:52:43 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EAFCC08C5CE for ; Thu, 9 Jul 2020 06:52:43 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id s9so2457717ljm.11 for ; Thu, 09 Jul 2020 06:52:43 -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; bh=gGVuo8ujJimg/zW9016fI/nLusAS6eB6X5j2AJ72Jog=; b=npvFezMTC8fOUcAN70TXMU8kzvjWJ2iynpk3U+Bf5E2N6rYnHzVn2idLDJ64d0yIDn idLfET28ODOTABtdRYtCqGmMJKGolCFnKUN+PIe7P0Gjg7dpGIyKAeHBhzyqbn9xOO3g DUkJ6ZCCf/89U8o3cCKCI3wRoLV6G7SFkMlhrzX+xFYOgeVDsdnS/Xa1VpPZanylz7qu UuTcYo4TZOOgh+c9GK3p295TFbpP0nx4m9XhUzRFTXxiwR+X2E7qL2Y4wVIrQO5+DP8+ oyN3E96ugzvXaQHIX1og1wNJNI02ilr6dhwoJsLMm3lYvtq3+IwzB0gGaKID6Rkj9b5E BdPg== 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; bh=gGVuo8ujJimg/zW9016fI/nLusAS6eB6X5j2AJ72Jog=; b=m1se6U2A2pETVReHnqWc+feh2/z06Tp9WXATpeHcxFoHo3RkKvSA308Dr4+IIcwYcr ACj+3BNUM+RfgBFUMisDkbeL6MA7T+wC4hRQWeKi5dAvQax7nc3TdD4FU2k8wloz/DJY H0bBgqlEgHGfIZcA0PAiA0cQXmJ0wRMzXlmViGrLV48CXAkuNX4UGEm5QhoY8rXtpSqD SYsQzE2XgxwKH2M/Z6ULSP7tdXHjWg8lJgFDXv8FtLzOS2C3ut80B87bHDP9XZgAncAY acpOlI3pfxgsHXOwYb6JGe/2KN3b+iowNWdTjEqQ2R29sA1f95ZVzleHjmt5zYEChvd5 barw== X-Gm-Message-State: AOAM533smSoqBGydFY+FNUXXxCBWv7ETyH5XjuDFsFbPNZu/AmhMFYOH Yg0+nOEId65g7Ox/SEMRlagligStfYM9BnmLuJ3THQ== X-Received: by 2002:a2e:7f10:: with SMTP id a16mr38244974ljd.69.1594302761669; Thu, 09 Jul 2020 06:52:41 -0700 (PDT) MIME-Version: 1.0 References: <20200702144258.19326-1-vincent.guittot@linaro.org> <4198cf3d-308e-feee-91c3-2edfd1748b4c@arm.com> <9a282390-1c81-0e77-9567-116c8777f7b5@arm.com> In-Reply-To: <9a282390-1c81-0e77-9567-116c8777f7b5@arm.com> From: Vincent Guittot Date: Thu, 9 Jul 2020 15:52:29 +0200 Message-ID: Subject: Re: [PATCH] sched/fair: handle case of task_h_load() returning 0 To: Dietmar Eggemann Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Steven Rostedt , Ben Segall , Mel Gorman , linux-kernel , Valentin Schneider Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 9 Jul 2020 at 15:34, Dietmar Eggemann wrote: > > On 08/07/2020 11:47, Vincent Guittot wrote: > > On Wed, 8 Jul 2020 at 11:45, Dietmar Eggemann wrote: > >> > >> On 02/07/2020 16:42, Vincent Guittot wrote: > >>> task_h_load() can return 0 in some situations like running stress-ng > >>> mmapfork, which forks thousands of threads, in a sched group on a 224 cores > >>> system. The load balance doesn't handle this correctly because > >> > >> I guess the issue here is that 'cfs_rq->h_load' in > >> > >> task_h_load() { > >> struct cfs_rq *cfs_rq = task_cfs_rq(p); > >> ... > >> return div64_ul(p->se.avg.load_avg * cfs_rq->h_load, > >> cfs_rq_load_avg(cfs_rq) + 1); > >> } > >> > >> is still ~0 (or at least pretty small) compared to se.avg.load_avg being > >> 1024 and cfs_rq_load_avg(cfs_rq) n*1024 in these lb occurrences. > >> > >>> env->imbalance never decreases and it will stop pulling tasks only after > >>> reaching loop_max, which can be equal to the number of running tasks of > >>> the cfs. Make sure that imbalance will be decreased by at least 1. > > Looks like it's bounded by sched_nr_migrate (32 on my E5-2690 v2). yes > > env.loop_max = min(sysctl_sched_nr_migrate, busiest->nr_running); > > [...] > > >> I assume that this is related to the LKP mail > > > > I have found this problem while studying the regression raised in the > > email below but it doesn't fix it. At least, it's not enough > > > >> > >> https://lkml.kernel.org/r/20200421004749.GC26573@shao2-debian ? > > I see. It also happens with other workloads but it's most visible > at the beginning of a workload (fork). > > Still on E5-2690 v2 (2*2*10, 40 CPUs): > > In the taskgroup cfs_rq->h_load is ~ 1024/40 = 25 so this leads to > task_h_load = 0 with cfs_rq->avg.load_avg 40 times higher than the > individual task load (1024). > > One incarnation of 20 loops w/o any progress (that's w/o your patch). > > With loop='loop/loop_break/loop_max' > and load='p->se.avg.load_avg/cfs_rq->h_load/cfs_rq->avg.load_avg' > > Jul 9 10:41:18 e105613-lin kernel: [73.068844] [stress-ng-mmapf 2907] SMT CPU37->CPU17 imb=8 loop=1/32/32 load=1023/23/43006 > Jul 9 10:41:18 e105613-lin kernel: [73.068873] [stress-ng-mmapf 3501] SMT CPU37->CPU17 imb=8 loop=2/32/32 load=1022/23/41983 > Jul 9 10:41:18 e105613-lin kernel: [73.068890] [stress-ng-mmapf 2602] SMT CPU37->CPU17 imb=8 loop=3/32/32 load=1023/23/40960 > ... > Jul 9 10:41:18 e105613-lin kernel: [73.069136] [stress-ng-mmapf 2520] SMT CPU37->CPU17 imb=8 loop=18/32/32 load=1023/23/25613 > Jul 9 10:41:18 e105613-lin kernel: [73.069144] [stress-ng-mmapf 3107] SMT CPU37->CPU17 imb=8 loop=19/32/32 load=1021/23/24589 > Jul 9 10:41:18 e105613-lin kernel: [73.069149] [stress-ng-mmapf 2672] SMT CPU37->CPU17 imb=8 loop=20/32/32 load=1024/23/23566 > ... > > Reviewed-by: Dietmar Eggemann > Tested-by: Dietmar Eggemann Thanks > > > > > > >