Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10139677rwr; Fri, 12 May 2023 04:31:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Ew0GlelO5yE/yOW2dWjtLtUE0adw58GZsiDiZ8jt/5+coLwBYKCdyLBVOIbedBBSaUR+I X-Received: by 2002:a05:6a00:14ca:b0:635:7fb2:2ab4 with SMTP id w10-20020a056a0014ca00b006357fb22ab4mr27930398pfu.6.1683891095213; Fri, 12 May 2023 04:31:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683891095; cv=none; d=google.com; s=arc-20160816; b=K+vAOex42q2TnKcDS+pGxaGpzi1yPJvIFC9pwFaIN0ux48rTUHN0T6ZtJC/A2QRrFT WzIMZruRGD8zEcWcHh3ZPpD9vIU6/oN4MCpIRR6ktgV9/Sn2o9cw3khthzh3CYs6b9Jv j+a14DLFLALBHf6mmtk0sPMg8hkb0TuSqTj7fzwCBVmTYGshjbey7j6cSJZnZJs9GT1c gEY+2eNLM5wc0Y7Leeub0db8pz1B5EZBb6IRjPm/FyH07ldl1x2w+JSTDFvk4EVOqUyy YTizSFeGAPTmGFKo5zyPkqX+gZoB5xJeleWM9a8Bfk5GDSQj3xw1BoyNfz+FL6u0Cd9F vDig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=k9tENOtTF4pQAE+JZzSZ4l7E5kO9k14V5nUvVvkpzPU=; b=jM1bwdkxOmL7SYkIzuDj0zzysXhjWeXytVPnD9a/SM95PwL8MhvUplYuE+3CgrNTCo /IDx1lVWvFVRXNctr3FszdoY+VNK/Te86LTGEmAyxim5x+l0y0sdLopGVggFQUhVmnYg yw3l2hDWi70Zum+shZbYTw2hFQzP7AVWjymHDj4/q3r0hkacRKK+6KbnPexu0IkUqTnT tgGRD+RarGlnqFvgHpj7+nymeZPSeReAJ9+mGvVzg3vsipvukXL2Hp8/iS3XbWV78v9v MXekjeMGEZkUY8vesepovNA7NigaOzurVW+NkuFf0qDHuGszEIKCbuEeD1E/Hc3W/aOK oPsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=FaGJV4VE; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k186-20020a6384c3000000b005303a36c1c0si2932704pgd.411.2023.05.12.04.31.21; Fri, 12 May 2023 04:31:35 -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=@infradead.org header.s=desiato.20200630 header.b=FaGJV4VE; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240710AbjELLWo (ORCPT + 99 others); Fri, 12 May 2023 07:22:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241093AbjELLWl (ORCPT ); Fri, 12 May 2023 07:22:41 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E241186 for ; Fri, 12 May 2023 04:22:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=k9tENOtTF4pQAE+JZzSZ4l7E5kO9k14V5nUvVvkpzPU=; b=FaGJV4VEgQPtxB9nUikY/10AlB Xhv7AvL6UteKPE7jX5YHtUFMs9lJ5U9XWQd46kTR4qbk9tv1+xcj4Pe9eVzjKoYPB4UPBitCXLGyz yCAOC+QF4X9EK34wF5bhbg3FNh4/d/AJOBCqzjs9S/MybW9AIZyBrxCe0gXLdCKNDHxvHIx3IjeyA wYXuiErR6ZG2+jDT6CkAkJ5vcmbLrLq1jO8aTnVTCoM1RLSp/d7YgiQ+sf7KzkEX4w7I8nEEC27rQ 4o+pCU0MDo/i0bm7j5r6SfWhU3VRQHiFn+QFZzX9m+wPA+1zrrHiUxZRdmCSLwLUzgMT/rZhjEjY7 JSSmfHIQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pxQr1-0098Hq-0x; Fri, 12 May 2023 11:22:31 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 256D4300338; Fri, 12 May 2023 13:22:29 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id D03E82C8B6AAE; Fri, 12 May 2023 13:22:29 +0200 (CEST) Date: Fri, 12 May 2023 13:22:29 +0200 From: Peter Zijlstra To: Dietmar Eggemann Cc: Ingo Molnar , Vincent Guittot , Qais Yousef , Kajetan Puchalski , Morten Rasmussen , Vincent Donnefort , Quentin Perret , Abhijeet Dharmapurikar , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] sched/fair, cpufreq: Introduce 'runnable boosting' Message-ID: <20230512112229.GW4253@hirez.programming.kicks-ass.net> References: <20230512101029.342823-1-dietmar.eggemann@arm.com> <20230512101029.342823-3-dietmar.eggemann@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230512101029.342823-3-dietmar.eggemann@arm.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Fri, May 12, 2023 at 12:10:29PM +0200, Dietmar Eggemann wrote: > -static unsigned long cpu_util(int cpu, struct task_struct *p, int dst_cpu) > +static unsigned long > +cpu_util(int cpu, struct task_struct *p, int dst_cpu, int boost) > { > struct cfs_rq *cfs_rq = &cpu_rq(cpu)->cfs; > unsigned long util = READ_ONCE(cfs_rq->avg.util_avg); > + unsigned long runnable; > + > + runnable = boost ? READ_ONCE(cfs_rq->avg.runnable_avg) : 0; > + util = max(util, runnable); > if (boost) util = max(util, READ_ONCE(cfs_rq->avg.runnable_avg)); > @@ -7239,9 +7246,9 @@ static unsigned long cpu_util(int cpu, struct task_struct *p, int dst_cpu) > * > * Return: (Estimated) utilization for the specified CPU. > */ Given that cpu_util() is the base function should this comment move there? > -unsigned long cpu_util_cfs(int cpu) > +unsigned long cpu_util_cfs(int cpu, int boost) > { > - return cpu_util(cpu, NULL, -1); > + return cpu_util(cpu, NULL, -1, boost); > } AFAICT the @boost argument is always a constant (0 or 1). Would it not make more sense to simply add: unsigned long cpu_util_cfs_boost(int cpu) { return cpu_util(cpu, NULL, -1, 1); } and use that in the few sites that actually need it?