Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp941111lqt; Fri, 7 Jun 2024 03:30:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWH3mnFJad9W1e19Xi9O6JmlyFnyB1ftwD7H7vO2U10eqVW/XXvb4w0UMi2WTwMmZmQMeKsTQ3lQxfE0rIr+bhjAcYpz2ht31BWfsHkCQ== X-Google-Smtp-Source: AGHT+IEysvscgURkFYP1txFE3OuTgNa5NtfDGEu2aPcFU9/7iEDvgwNUOAFA4MI/vQkLZcQFI+Cn X-Received: by 2002:a05:6a21:78aa:b0:1b0:20e9:d215 with SMTP id adf61e73a8af0-1b2e74b2376mr3336772637.14.1717756225179; Fri, 07 Jun 2024 03:30:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717756225; cv=pass; d=google.com; s=arc-20160816; b=ODW9Zdk/CtmUVMKpxDbvjHh/Ag3Fp+q6A3FwC0amgFoPGuTY8oOYTnRJSdTDK1Nlru mzR91Q4CbhuvLpe9+lnU0j7oOsJSt2aeFPpI8uF4aFFWczmrOwGj3Kwgj9d10sH7H02p Ob9VCrTHeS0tU2TsuoI4tbJRRLGPrj2PM3Gvwr5WhpDjuYfMvM6skS1uid2nwFb0bmnX Q1VyAKMUYKyXCKQ1PRTAFdLwO1YvGFPWtrzDFX+q51r5qG5H6tyWMe0PYhvCVOEj3ciH +v2SMT9Eoqf8W6S+ucuuY73sW2ITw2pYzedIi7cvNd553LTju1vmCjTzl/LYCawNtyom crJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=7B37uSsQIgs2X/RJObZhXb4mgWg6FlmM66ZZoWrxrxA=; fh=jfnosv59/pnkJb7+d/VCdkyj9rSg3UBHra6U7S+AtDw=; b=Fpr07gQHq/hReL8wY65C0SYLt0AivrVQIA+eScBvg3nI4KnKdnn7t26LXO5Rha97Mw CaoEbfg/XJ186bl2/jdAVRl8bOrBH0ciTB+FTH0NbHg0Mp2iJkTtGhWa8ZbCziTEOgCf OB+HEGonLSKxz3uR+2y5BT+8rIyXoh6h21a4h6d2btvVXteZjVC2Wgs3fcYtNXavpJDZ Gt83m2D57X1K+S3t5NZ49lVqM3C2vbergfE6uxFNh4d9w4hv6UrzK6Y8hREzzHkE9lbM oQtQDXLJ94+FUuWpRMqLsL9IHE8UGwfGJUs0zq6odyvKpCvhJe5q2WzUevTSe69dI1hV 806g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-205822-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205822-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-703fd561686si2788841b3a.305.2024.06.07.03.30.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 03:30:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205822-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-205822-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205822-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1D7FF287984 for ; Fri, 7 Jun 2024 10:30:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE67D15D5A5; Fri, 7 Jun 2024 10:30:19 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8039E158214 for ; Fri, 7 Jun 2024 10:30:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717756219; cv=none; b=Yx+ZyociwDEHedSJhHsXD+OwExeGZAex8h/s5tU/nAJfKNYdvF3UQGDQBEFdtekc2Fe+YXGKYj8nnbVlkyU/nxHKIhgvbWVIJQrfOVn2Kz5beStBsH4RS2NOgj3HKx11HMrVmyAEack+ESbMqkIde1y3CL5sVG31LAleyjbV1kk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717756219; c=relaxed/simple; bh=NccNIYy2Gy7W2SjQwlZRh0VSwGC/qT4hnXlrb21+hQU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hGyaYvYW6ClvCTPaBLRnwuUnuDXTs1RCtB2ZBCPG7XGI7T9qRmfJq7Ybg6ubOTzx4GjBAxv4gT8gatJnmy5Bk4TofP7pnHNi/u7kCQydWXIR9AzPYTUPAQhmook2SCQGn3/SclVWw4yf0nee5J4lXUpFnbX9d9gpvfu4M996HbE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BD8222F4; Fri, 7 Jun 2024 03:30:40 -0700 (PDT) Received: from [192.168.2.88] (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 101DD3F64C; Fri, 7 Jun 2024 03:30:13 -0700 (PDT) Message-ID: <64115627-c6c7-416b-99f9-0df22cbdca6b@arm.com> Date: Fri, 7 Jun 2024 12:30:12 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] sched/fair: Prevent cpu_busy_time from exceeding actual_cpu_capacity To: Xuewen Yan Cc: Xuewen Yan , vincent.guittot@linaro.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, vincent.donnefort@arm.com, qyousef@layalina.io, ke.wang@unisoc.com, linux-kernel@vger.kernel.org References: <20240606070645.3295-1-xuewen.yan@unisoc.com> <0763f870-e30c-46cf-aefa-b879f2ebdba4@arm.com> From: Dietmar Eggemann Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 07/06/2024 10:20, Xuewen Yan wrote: > Hi Dietmar > > On Fri, Jun 7, 2024 at 3:19 PM Dietmar Eggemann > wrote: >> >> On 06/06/2024 09:06, Xuewen Yan wrote: >>> Because the effective_cpu_util() would return a util which >>> maybe bigger than the actual_cpu_capacity, this could cause >>> the pd_busy_time calculation errors. >> >> Doesn't return effective_cpu_util() either scale or min(scale, util) >> with scale = arch_scale_cpu_capacity(cpu)? So the util sum over the PD >> cannot exceed eenv->cpu_cap? > > In effective_cpu_util, the scale = arch_scale_cpu_capacity(cpu); > Although there is the clamp of eenv->pd_cap, but let us consider the > following simple scenario: > The pd cpus are 4-7, and the arch_scale_capacity is 1024, and because > of cpufreq-limit, Ah, this is due to: find_energy_efficient_cpu() ... for (; pd; pd = pd->next) ... cpu_actual_cap = get_actual_cpu_capacity(cpu) for_each_cpu(cpu, cpus) ... eenv.pd_cap += cpu_actual_cap and: get_actual_cpu_capacity() ... capacity = arch_scale_cpu_capacity(cpu) capacity -= max(hw_load_avg(cpu_rq(cpu)), cpufreq_get_pressure(cpu)) which got introduced by f1f8d0a22422 ("sched/cpufreq: Take cpufreq feedback into account"). [...]