Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3551333pxb; Mon, 25 Jan 2021 21:04:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTI25ETDw4oQRCLEsFMNvClXZWSv7xlkaeJdROTlWC2kclQMPgasfOyw51P3MTvyZcfL4j X-Received: by 2002:aa7:d306:: with SMTP id p6mr3231669edq.351.1611637482794; Mon, 25 Jan 2021 21:04:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611637482; cv=none; d=google.com; s=arc-20160816; b=FCWiAxYR4dpmW+ZoE/W9bDJh3asHD3UBkKA9ziBvSU1HjysJXc6fCiJyFxBPtNiZZd ZX4gnYITQz2hnl3m4q76NW+G807YxpHqAVkTBqRhKE1VHVBdT7OiVHVc2PxrjYVY55bj QwXLvLYGpJNZ4iviYE2Bpi1n1UqoOek+Qqv4T+CpAF+vCE0Sf5GBWGcRyPete/XjT7Qx wgouSqnXg+ErXtP3Ni4IqS5iRIDezGnOzoaPHLyQIzuTe5jMtEUDbDiyogGLQB72A8ks PBMWNXzjb9HsqfUdQGrBbQmJ6+A/I2CbkizckEPXDD1gTjr2JhNr+cf0HyDQpXDERSNf 9XRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=4CmcPbt32Txoe/l3dyJp61V9E2x9wOzzw+F49mqAdqs=; b=XAUdfYK2KdksTR1eHEvxH7UFAWh+p1vK3DBhuaUGweQYS7q+83tHi1EURex2dY8Mls sxIpuwNeOm/GAT+vlsTynxICJuSGBreUP4PE/579RM6gQy1X6NnZWxQcmMqzZ/81r5i5 L0rgTCvo+9TaVvSoJ21XTOaCKNRvPG5V+zCZ05le70K3PnD6ithzqpSTof6+Bp0daKSq +RbP/Z7YUwNJ4FJuMlkqStd3yhLC9aGMEZJTz/QRS9nd3YHHnOkiHy5YcVX8kl5mAcr7 66J48CjjAodKHYXwXKY54DPhjsMDgqZcqtl6VmauDSRIRBn/WXJBZI3jfjrfqwBJcfF5 HstQ== 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 hq36si6711293ejc.590.2021.01.25.21.04.18; Mon, 25 Jan 2021 21:04:42 -0800 (PST) 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 S1728700AbhAZEvb (ORCPT + 99 others); Mon, 25 Jan 2021 23:51:31 -0500 Received: from outbound-smtp25.blacknight.com ([81.17.249.193]:34384 "EHLO outbound-smtp25.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbhAYJRS (ORCPT ); Mon, 25 Jan 2021 04:17:18 -0500 Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp25.blacknight.com (Postfix) with ESMTPS id 220D942087 for ; Mon, 25 Jan 2021 09:06:31 +0000 (GMT) Received: (qmail 14252 invoked from network); 25 Jan 2021 09:06:30 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 25 Jan 2021 09:06:30 -0000 Date: Mon, 25 Jan 2021 09:06:29 +0000 From: Mel Gorman To: Aubrey Li Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, linux-kernel@vger.kernel.org, Andi Kleen , Tim Chen , Srinivas Pandruvada , "Rafael J . Wysocki" , Aubrey Li Subject: Re: [RFC PATCH v1] sched/fair: limit load balance redo times at the same sched_domain level Message-ID: <20210125090628.GX3592@techsingularity.net> References: <1611554578-6464-1-git-send-email-aubrey.li@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1611554578-6464-1-git-send-email-aubrey.li@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 25, 2021 at 02:02:58PM +0800, Aubrey Li wrote: > A long-tail load balance cost is observed on the newly idle path, > this is caused by a race window between the first nr_running check > of the busiest runqueue and its nr_running recheck in detach_tasks. > > Before the busiest runqueue is locked, the tasks on the busiest > runqueue could be pulled by other CPUs and nr_running of the busiest > runqueu becomes 1, this causes detach_tasks breaks with LBF_ALL_PINNED > flag set, and triggers load_balance redo at the same sched_domain level. > > In order to find the new busiest sched_group and CPU, load balance will > recompute and update the various load statistics, which eventually leads > to the long-tail load balance cost. > > This patch introduces a variable(sched_nr_lb_redo) to limit load balance > redo times, combined with sysctl_sched_nr_migrate, the max load balance > cost is reduced from 100+ us to 70+ us, measured on a 4s x86 system with > 192 logical CPUs. > > Cc: Andi Kleen > Cc: Tim Chen > Cc: Srinivas Pandruvada > Cc: Rafael J. Wysocki > Signed-off-by: Aubrey Li If redo_max is a constant, why is it not a #define instead of increasing the size of lb_env? -- Mel Gorman SUSE Labs