Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp958177lqt; Tue, 19 Mar 2024 08:42:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVHRbocXokS3j2pqM+fGRhmAPKWYBGXRRZSCCFe7f3ULDA5Gf+rrSBvq9+izs8NpD5QS7hF17weEjWGmzSjU4NFRg72MszeqAMwvaA6VQ== X-Google-Smtp-Source: AGHT+IHG4ccuaRpEyStmqrIutHIvry4hajU8fvOaHHxsExXK/kMBQnnrL9K/y/RYH81fFFnSMWek X-Received: by 2002:a05:6402:3986:b0:568:223e:f2b0 with SMTP id fk6-20020a056402398600b00568223ef2b0mr12849455edb.21.1710862967419; Tue, 19 Mar 2024 08:42:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710862967; cv=pass; d=google.com; s=arc-20160816; b=NNT2IYtb38rjj8wWSLLtO4byCwBc8riFwOBl1khRIlDwL92Svhw5JLkofdkrLccBer 8EzH7YNyVYnvsCdHZ67pu3aw/ruQoe+CurBkLXkXseAy2dOmKp655v7YckfRjLRSHPkE ttWch9HuUY2rev4hLeNJ9NX8Zxg6asdgKHQaD9tMY9OYyuupNajqxrncSu+x3fJDoAlh epaDWzJ2jpv4UdWp7IE+upU/kXwfEEjpXuZix9GtIR9W3lAmVT+qZ+7fPrsWNU+wDIaP AZ+uy80xgqx/4Dsw+6o1bI/5xaAp8xUQc6IlxiB9NFgkuWEtvHYPbcQWmFgM0N5CggBb ehmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=SmIatLFjudCAf5PsKYxTOiTL5KB2+2JFisMT9OezCZc=; fh=JxM0p65b6kQ9yDGwklbxf/YU91C50kGZXocewhmkP0M=; b=ZDSFhCoF4dYaiIAwfej9VTyF1LesHyYdBwtU/ytUnkoUAt34yfgg7+4K9R0nm/L9vC 3IoGxlZK6WfNjfZQYA2PCUo+DDEXNSPQumTDh74RW4EgAFBELWFlnnsG4zK1G5O47fpr dKHbX3wbQOaCB6ZyrjruKHuid3B9xEjeIJJds/fLYeBWAfJS/c9bNTwEEaB4jh4DmZG9 vWfLh8eaG7YSEWvTd1moy2DrY8jNDkzhRufeE6XxptQGFgdIivxq+kvVHJ5WLMIiDAVh cAalVM9iODbnQVR4jq7wqHBb8u+ynm6livvOXVUQ3BlMVAvR1fxVhRw1fi2Cb9nVtB+T a1hg==; 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-107723-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107723-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 29-20020a50875d000000b005689f735366si5674897edv.551.2024.03.19.08.42.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 08:42:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107723-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-107723-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107723-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 68C051F2579F for ; Tue, 19 Mar 2024 15:34:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B9C20657C3; Tue, 19 Mar 2024 15:34:29 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A815D62818 for ; Tue, 19 Mar 2024 15:34:26 +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=1710862469; cv=none; b=SfuAxiC2a7driJk8615wZV7URqgJKDl1zoNFEDL3VQM7i3Gy6V6baFjkt6+lnJIVwpF6Tj85mqCOSOXBOlfqm2fSuZvMSPyRm+R4Zwu1JVpVWYswKkt3FH+S1CwPVy7Z7Ke1FJDwQDtFwwFJ5oGl11h/BOKGn7T2R/gQUqrPU64= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710862469; c=relaxed/simple; bh=2zIx223pHdeo5JZhKCcDLIzNBieISMOnQ0KJcW4Y2rw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=DBEjF9vDWL3MyY1oPbrcBodxLCqxxZig9xppGf4FmbGGnBaIRDEK5nkRXYK1BCsJHbOSulkEkMOdVaww5DaMn1JdabQsPuyNVQ5AI8Drbj5DsmBDfVQxnTRFOK3Xb9/krgAaMAneE3Mw+XBX270FEXnZcJs3Bo6197D9ZrQbn2A= 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 B6B45106F; Tue, 19 Mar 2024 08:35:00 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5C1723F762; Tue, 19 Mar 2024 08:34:22 -0700 (PDT) Message-ID: <37be0494-7e38-4275-b6eb-62a2eb2f6d46@arm.com> Date: Tue, 19 Mar 2024 16:34:16 +0100 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: [RFC PATCH v2 1/7] Revert "sched/uclamp: Set max_spare_cap_cpu even if max_spare_cap is 0" Content-Language: en-US To: Hongyan Xia , Ingo Molnar , Peter Zijlstra , Vincent Guittot , Juri Lelli , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Cc: Qais Yousef , Morten Rasmussen , Lukasz Luba , Christian Loehle , linux-kernel@vger.kernel.org, David Dai , Saravana Kannan References: From: Dietmar Eggemann In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 01/02/2024 14:11, Hongyan Xia wrote: > From: Hongyan Xia > > That commit creates further problems because 0 spare capacity can be > either a real indication that the CPU is maxed out, or the CPU is > UCLAMP_MAX throttled, but we end up giving all of them a chance which > can results in bogus energy calculations. It also tends to schedule > tasks on the same CPU and requires load balancing patches. Sum > aggregation solves these problems and this patch is not needed. > > This reverts commit 6b00a40147653c8ea748e8f4396510f252763364. I assume you did this revert especially for the 'Scenario 5: 8 tasks with UCLAMP_MAX of 120' testcase? IMHO, the issue is especially visible in compute_energy()'s busy_time computation with a valid destination CPU (dst_cpu >= 0). I.e. when we have to add performance domain (pd) and task busy time. find_energy_efficient_cpu() (feec()) for each pd for each cpu in pd set {prev_,max}_spare_cap bail if prev_ and max_spare_cap < 0 (was == 0 before ) {base_,prev_,cur_}energy = compute_energy So with the patch we potentially compute energy for a saturated PD according: compute_energy() if (dst_cpu >= 0) busy_time = min(eenv->pd_cap, eenv->busy_time + eenv->task_busy_time) <----(a)---> <--------------(b)-------------------> energy = em_cpu_energy(pd->em_pd, max_util, busy_time, eenv->cpu_cap) If (b) > (a) then we're saturated and 'energy' is bogus. The way to fix this is up for discussion: (1) feec() returning prev_cpu (2) feec() returning -1 (forcing wakeup into sis() -> sic()) (3) using uclamped values for task and rq utilization None of those have immediately given the desired task placement on mainline (2 tasks on each of the 4 little CPUs and no task on the 2 big CPUs on my [l B B l l l] w/ CPU capacities = [446 1024 1024 446 446 446] machine) you can achieve with uclamp sum aggregation. [...]