From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DF81C433F5 for ; Tue, 12 Oct 2021 12:27:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E16E610D1 for ; Tue, 12 Oct 2021 12:27:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236405AbhJLM3g (ORCPT ); Tue, 12 Oct 2021 08:29:36 -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?