Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2378992pxb; Tue, 12 Oct 2021 05:30:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfkxypK/CHJpPxQlcPGO1b816wvrsbFlXuWo3j4LEaLkLMCTUd+8QI9fqgU3a75kpktH76 X-Received: by 2002:a17:906:b6d0:: with SMTP id ec16mr34175077ejb.229.1634041816759; Tue, 12 Oct 2021 05:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634041816; cv=none; d=google.com; s=arc-20160816; b=sc8OVqv5hdJyQZQWzxeiAfgj92e5z9ml8W79cSMBpwatcRAOYKOAgfbmoGxM/lyVCX 4nkAV4W2RjKCqV+/j3rJ4hQZfCsirwCBikTtlSDo++vNGsr/5kAXwcyJ8/P/LanmCxt6 MhoVKQKp/18TWTM2AZSpgejfyJzHirCD+O6RThhWolXg8IklLcw9VhmA4U8GQGzTxBli 0ZLbQpsirCKneAA5/FUT8FLjZ9Qmi2H4nhrVCGD5FItVk+sqiWex/9veC7pW7BQQYlu3 NDTMepXG8qcOaXlx8fC6AijLts61rdkeNNUU0AAGJfDO0tOyUI/BwEDAzgE1zHyyhFBB dUWw== 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=ffPHDJJEvo/WkeBn4dyBDe1/NGOwywL+tze3tYyLZNg=; b=YT08jcLQTkJmAi4EaNOW9QY5Np3LDsW4kdl7G/83N0Y242AtvhVJJ3y646HlDaduLR qfH6L2hcBuOkLYiNgog7IN7iEzbEa06tQwo5shMt2iV7+HY1gVFye16hBjK4ID0qVogL /HFViSAMDzXMyVOOWfqvx7VvmqmSMmH8bWfL9W9A2OjGemOyIkQFa1l2j2PY4vE4eVZS BJZ/8BxhVRbzP8+aod/MbzBuk0sVTftdFaZcEYtIkRNp5zNsZvIdVWJe3cBvcuExTCUI Z+v1Zw16iSJhnWR05dbDyfqYAF99Ay4njCrP0peK8MBfBPg5pBCKen58Z/igipgNqZ6g QvQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=YuNHCGiy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j5si4770940ejm.413.2021.10.12.05.29.52; Tue, 12 Oct 2021 05:30:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=YuNHCGiy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236323AbhJLM3f (ORCPT + 99 others); Tue, 12 Oct 2021 08:29:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236344AbhJLM3f (ORCPT ); Tue, 12 Oct 2021 08:29:35 -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 69733C061570 for ; Tue, 12 Oct 2021 05:27:33 -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=ffPHDJJEvo/WkeBn4dyBDe1/NGOwywL+tze3tYyLZNg=; b=YuNHCGiyEF91GQSGBJhptO//l5 aLOxnPn7YBu9ig9+Yo72doRaHS7QtYgqEaLeTqe5XJOEKEaeJfVqvBh1nx8L4vsIGXlZcFcnR7/S3 SjurpGumPVTfQWMZT/OrebfoZYKkcpcsv0JSSf9w1E5vtypi4+iNDvbtOb1QEusrJBQbfXlu8MEZ9 75st3h11eddDSutAjI+cveJ9hqLN3zI8J875n+C8Z6Ad3CgBCbMDBP4ME9s+/HIhc1DMMm+4eJb0n 2xgPzLvMewawP5XKsuYYUhO9XzobC0nueP3pFf/RSrA3FitGhdaEtYL1qRnUkrrzo+TIcn6oEjnTs Hc4vkd2A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1maGsA-009PZ0-BL; Tue, 12 Oct 2021 12:27:10 +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 (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 53CF1300079; Tue, 12 Oct 2021 14:27:09 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0FC4A212D6A1E; Tue, 12 Oct 2021 14:27:09 +0200 (CEST) Date: Tue, 12 Oct 2021 14:27:08 +0200 From: Peter Zijlstra To: Josh Don Cc: Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Joel Fernandes , Vineeth Pillai , Hao Luo , linux-kernel Subject: Re: [PATCH] sched/core: forced idle accounting Message-ID: References: <20211008000825.1364224-1-joshdon@google.com> <20211009155435.GW174703@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 11, 2021 at 05:12:43PM -0700, Josh Don wrote: > > > + if (WARN_ON_ONCE(!nr_running)) { > > > + /* can't be forced idle without a running task */ > > > + } else { > > > + delta *= nr_forced_idle; > > > + delta /= nr_running; > > > + } > > > > Now the comment sayeth: > > > > > + /* > > > + * For larger SMT configurations, we need to scale the charged > > > + * forced idle amount since there can be more than one forced idle > > > + * sibling and more than one running cookied task. > > > + */ > > > > But why? > > We scale by the number of cpus actually forced idle, since we don't > want to falsely over or under charge forced idle time (defined > strictly as time where we have a runnable task but idle the cpu). The > more important scaling here though is the division over the number of > running entities. This is done so that the aggregate amount of forced > idle over some group of threads makes sense. Ie if we have a cpu with > SMT8, and a group of 7 threads sharing a cookie, we don't want to > accrue 7 units of forced idle time per unit time while the 8th SMT is > forced idle. So why not simply compute the strict per-cpu force-idle time and let userspace sort out the rest?