Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp1231752rwl; Fri, 4 Nov 2022 11:18:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7mZlXWjnbAxQ6W0nQcxh7eU1hb0ojdwNplXL4pqSVgJ1bsFNKg+EK6j9mQ9bMmyjiwLIUW X-Received: by 2002:a05:6402:1f06:b0:457:149d:beaa with SMTP id b6-20020a0564021f0600b00457149dbeaamr36711762edb.238.1667585928518; Fri, 04 Nov 2022 11:18:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667585928; cv=none; d=google.com; s=arc-20160816; b=0kbo8j1MfO53qqbNzuY3G9yR3Dg+wGpQWXlVmDfUo94mzatLb+FxmS62mH/7iHDiqB GIVqlAQZAk21pi00zMknZVG0Ju0FIqkpRBl5FHISnJeHOBZU5y3wvy5AcSnrgZD8VR1J GmnxSa/AfnrR4UmYVKUi43OxGdJ+S6srvbY+xtwe95/ocR9qZ2djJP5Hix+86IKTpDwa qiU0vyKEith/XI7I+H8rViO0QZ6LV6yqd0ESbE+X12ZkHjehiVlK0VJA5PEqZsK0wBq+ zGe/KYEkokUXYcxeCLS61ckS8Aws3Z71WsFkR0df1Z5A8DRrOMkrhamVuubUemG5VIP7 3WDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=RMvES9h1ylliLgVwkULg2x1BbxHd2t6jSiU8MP78/C0=; b=kEO4o9FRWkjUIJHE097MWidoPH9sUWYc++uwgTEWq5UQa0AptHdFJIkb1AvT6q9Wfx CDgWsKvHh64upnu+JpFbQLckq0clOhcQ5UZaSOFRxRFVcVak3kGsHi03PY24pFPJaueg DtbJi2RJ58KK0ah879qCrjBtJJW2q7QLTI5SRgbAQFkEJu+4yv2Q9XgzWBnyYjAxwJU2 ysRQiCqx1RfswzpQ7KHbgyRsKAr6WjV4xnoG5P/RLltrv++q6ue5xLUz3ScgvPCuQRh/ ls01mZY2yeW9HKRtovwWTeNkhjokIfrpKyhgB3VbrRMzQATyZlk3xAMn6feGauQ2aaH6 J4mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dDzsWagk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d29-20020a056402401d00b00461c7ad026csi219511eda.61.2022.11.04.11.18.25; Fri, 04 Nov 2022 11:18:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dDzsWagk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231395AbiKDRgv (ORCPT + 96 others); Fri, 4 Nov 2022 13:36:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231387AbiKDRgl (ORCPT ); Fri, 4 Nov 2022 13:36:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83E4432065 for ; Fri, 4 Nov 2022 10:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667583337; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RMvES9h1ylliLgVwkULg2x1BbxHd2t6jSiU8MP78/C0=; b=dDzsWagkYU7XjvfYZ6dfYWp7wcbrA39OujbcTC1XWCYuk86FTVQfe6LEcxrQkmh3JbP5ep A74icsQreZLmoK6gwYxx30y8wcILKcXUNMqqt7Vus4ohWX+e1uN5F5SuPpCFgtbs8+WHeW OgDtte5EBsyyK8l8ednY295neG/3lqM= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-157-nm78KVCrOyS0uAabwPOYTg-1; Fri, 04 Nov 2022 13:35:36 -0400 X-MC-Unique: nm78KVCrOyS0uAabwPOYTg-1 Received: by mail-wm1-f71.google.com with SMTP id f62-20020a1c3841000000b003cf6d9aacbbso2602992wma.8 for ; Fri, 04 Nov 2022 10:35:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RMvES9h1ylliLgVwkULg2x1BbxHd2t6jSiU8MP78/C0=; b=o35icfPO9lZ7o0p5EJVoBaK+bxY0HDOU4ZEqDcC9ARkVlt7WCTIPFtv7zIfluNx9Mv imI/Qiw13UZyJbKpfc+uBcpu7prdr/Ucr3VoYEYIjAABhyN0T0P5dcdLGYQNfNADp1K4 RkHICM+88RjuGlB8yV3xf/tUfToZ9hyurMytcVTWa9+Ewwg1ovMQyB3f4UmwiFqZhOUN VGZuSurMAumxrJU5eIYu76xsaMlGm+rZd47j8UICLhU56pj/Extrfi3p1jMkYc9g22NW +6yuqbJYnB4XLPqmGUzrKeX9hkkLJy0+tR2LNeHm4+rC4PxeU+6IfUxhTA/VgNTwH+QX CiWA== X-Gm-Message-State: ANoB5pmVQyV5WjCGQei4/tZWyRGVLTYFvZvoOoPhIiSaxDzCi8q3zuq2 J5cNO3DuVb15lADDyq+SCcHbqoK75GPRESDtpQNx6LXwzJhMgvHLywJTbvQPE+UvnUJ7FxHMA9F 7tF0OMdFGSOEatR0nbo1AOTOS X-Received: by 2002:a5d:6909:0:b0:23a:fbdc:3791 with SMTP id t9-20020a5d6909000000b0023afbdc3791mr2636246wru.60.1667583335230; Fri, 04 Nov 2022 10:35:35 -0700 (PDT) X-Received: by 2002:a5d:6909:0:b0:23a:fbdc:3791 with SMTP id t9-20020a5d6909000000b0023afbdc3791mr2636233wru.60.1667583335045; Fri, 04 Nov 2022 10:35:35 -0700 (PDT) Received: from vschneid.remote.csb ([154.57.232.159]) by smtp.gmail.com with ESMTPSA id c3-20020a5d5283000000b002206203ed3dsm3872851wrv.29.2022.11.04.10.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 10:35:34 -0700 (PDT) From: Valentin Schneider To: Qais Yousef , Ingo Molnar , "Peter Zijlstra (Intel)" , Vincent Guittot , Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, Xuewen Yan , Lukasz Luba , Wei Wang , Jonathan JMChen , Hank , Qais Yousef Subject: Re: [PATCH v2 1/9] sched/uclamp: Fix relationship between uclamp and migration margin In-Reply-To: <20220804143609.515789-2-qais.yousef@arm.com> References: <20220804143609.515789-1-qais.yousef@arm.com> <20220804143609.515789-2-qais.yousef@arm.com> Date: Fri, 04 Nov 2022 17:35:33 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'm only seeing this now that it has hit tip/sched/core and I've had a stroll through fair.c, apologies for this being late. On 04/08/22 15:36, Qais Yousef wrote: > +static inline int util_fits_cpu(unsigned long util, > + unsigned long uclamp_min, > + unsigned long uclamp_max, > + int cpu) > +{ > + unsigned long capacity_orig, capacity_orig_thermal; > + unsigned long capacity = capacity_of(cpu); > + bool fits, uclamp_max_fits; > + > + /* > + * Check if the real util fits without any uclamp boost/cap applied. > + */ > + fits = fits_capacity(util, capacity); > + > + if (!uclamp_is_used()) > + return fits; > + > + /* > + * We must use capacity_orig_of() for comparing against uclamp_min and > + * uclamp_max. We only care about capacity pressure (by using > + * capacity_of()) for comparing against the real util. > + * > + * If a task is boosted to 1024 for example, we don't want a tiny > + * pressure to skew the check whether it fits a CPU or not. > + * > + * Similarly if a task is capped to capacity_orig_of(little_cpu), it > + * should fit a little cpu even if there's some pressure. > + * > + * Only exception is for thermal pressure since it has a direct impact > + * on available OPP of the system. > + * > + * We honour it for uclamp_min only as a drop in performance level > + * could result in not getting the requested minimum performance level. > + * Why specifically care about OPPs here? Per our CPU capacity model, a task alone on a CPUx throttled to f=fmax/2 and a task coscheduled on a CPUy with RT/DL tasks and/or IRQs such that cpu_capacity(CPUy) = 50% are both getting (roughly) the same performance level.