Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3146826rdb; Wed, 13 Sep 2023 03:42:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGGOuppl2IjC+hBelbsahug98SoXQQXqVC94Et3bi/tOwaAPv4RMTbZEBO2GxJ/NWcCRYb/ X-Received: by 2002:a9d:6a94:0:b0:6c0:f451:ab6a with SMTP id l20-20020a9d6a94000000b006c0f451ab6amr2453882otq.8.1694601743427; Wed, 13 Sep 2023 03:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694601743; cv=none; d=google.com; s=arc-20160816; b=z0Y4DIP5aTenYGAl2pD+2FV0kqG/acNDZHAeDDG9TtA0RlWFC7ZF7GSQnh85X4Iz+8 xLEk5nU+8rEW6W8gEht6dfLmKqNBbFcDCaEZaa0y8NlFWK3ZOgu9EAIypGHPWus2VzJF WpbzWa2PhmqENnO0L1yVX7KEvU9+PAXrFwUblB2+Ux2TBKATXo3VKto8JUnijfGPnTfF 8fzKWwBFRbjV3iyKpfu1uLOtLDmhXpz914kQ/zHaOWj5Cd0vY5Kiu9W6OzAkZCkbh3tb JvYawJp3/kag5LiRINGSzQoswQD7SrXaY6rd1/eYYCHRkT1WP3laErFXJg9s9GB28tEk aftg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=tXSFcg0UaCjsafn8nayIJqmlEIPMP1nILDj5qEHB1ho=; fh=zIyQQJOZBmXC1ZQzyJ7akq9rAtE2P1F0/q00YV/iyXY=; b=BeVRBVxUHxivT3IMbSxn/BvI1jP3Nm/VWVbN62FtWxmy14EtheA/YOKTbU0CGLGLgW b3dWMNISNH52bd+bp8ddjgikjF8DKdCrOzazjmnzCRNZXcmwoo17jXfbqQvmDJkZUFao j9zdWonvpQT2aZR9zVTVWE+DD3958TZ2Ssmv9/PvcXogxt010AJU1uORpmmJoxxk6Dbn gLNu5zKHUwA0NvTPMRq1iaa6PGaVoMh7YsmD8NeQGSv/k0LhXZ4qDwtCyZymeN92lzJV E0JtFolxxJ+ROcE8H9WggbFC6mHevtC87piZXxP+naMtoHqt+5zgPdMCC0oHupO8qrJx 3MGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id cq12-20020a056a00330c00b00682759c6440si9854784pfb.40.2023.09.13.03.42.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 03:42:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4DB14802B06B; Tue, 12 Sep 2023 10:18:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237034AbjILRSj (ORCPT + 99 others); Tue, 12 Sep 2023 13:18:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237000AbjILRSj (ORCPT ); Tue, 12 Sep 2023 13:18:39 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 13BF410E9; Tue, 12 Sep 2023 10:18:35 -0700 (PDT) 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 5B402C15; Tue, 12 Sep 2023 10:19:11 -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 C327E3F738; Tue, 12 Sep 2023 10:18:32 -0700 (PDT) Message-ID: <356ec193-5c89-4f7e-5e43-d600dff68cf9@arm.com> Date: Tue, 12 Sep 2023 19:18:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [RFC PATCH 0/7] sched: cpufreq: Remove magic margins Content-Language: en-US To: Qais Yousef Cc: Peter Zijlstra , Ingo Molnar , "Rafael J. Wysocki" , Viresh Kumar , Vincent Guittot , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Lukasz Luba References: <20230827233203.1315953-1-qyousef@layalina.io> <20230907130805.GE10955@noisy.programming.kicks-ass.net> <20230908001725.mtqbse3xwhzvo5qp@airbuntu> <44fc6d03-c663-53de-e4f7-e56687c5718d@arm.com> <20230908140757.haewcuwsumphcv7p@airbuntu> From: Dietmar Eggemann In-Reply-To: <20230908140757.haewcuwsumphcv7p@airbuntu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 12 Sep 2023 10:18:42 -0700 (PDT) On 08/09/2023 16:07, Qais Yousef wrote: > On 09/08/23 09:40, Dietmar Eggemann wrote: >> On 08/09/2023 02:17, Qais Yousef wrote: >>> On 09/07/23 15:08, Peter Zijlstra wrote: >>>> On Mon, Aug 28, 2023 at 12:31:56AM +0100, Qais Yousef wrote: [...] >>> And what was a high end A78 is a mid core today. So if you look at today's >>> mobile world topology we really have a tiy+big+huge combination of cores. The >>> bigs are called mids, but they're very capable. Fits capacity forces migration >>> to the 'huge' cores too soon with that 80% margin. While the 80% might be too >>> small for the tiny ones as some workloads really struggle there if they hang on >>> for too long. It doesn't help that these systems ship with 4ms tick. Something >>> more to consider changing I guess. >> >> If this is the problem then you could simply make the margin (headroom) >> a function of cpu_capacity_orig? > > I don't see what you mean. instead of capacity_of() but keep the 80%? > > Again, I could be delusional and misunderstanding everything, but what I really > see fits_capacity() is about is misfit detection. But a task is not really > misfit until it actually has a util above the capacity of the CPU. Now due to > implementation details there can be a delay between the task crossing this > capacity and being able to move it. Which what I believe this headroom is > trying to achieve. > > I think we can better define this by tying this headroom to the worst case > scenario it takes to actually move this misfit task to the right CPU. If it can > continue to run without being impacted with this delay and crossing the > capacity of the CPU it is on, then we should not trigger misfit IMO. Instead of: fits_capacity(unsigned long util, unsigned long capacity) return approximate_util_avg(util, TICK_USEC) < capacity; just make 1280 in: #define fits_capacity(cap, max) ((cap) * 1280 < (max) * 1024) dependent on cpu's capacity_orig or the capacity diff to the next higher capacity_orig. Typical example today: {little-medium-big capacity_orig} = {128, 896, 1024} 896รท128 = 7 1024/896 = 1.14 to achieve higher margin on little and lower margin on medium. [...]