Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1007885iob; Fri, 13 May 2022 19:24:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx98izdYxsCd02gvD31OE0HgL0HP3ns48dSvEAhfACki8R5QpExXVk51nfBgIm9nUzzgO06 X-Received: by 2002:a05:6000:715:b0:20c:5a15:9409 with SMTP id bs21-20020a056000071500b0020c5a159409mr6129830wrb.146.1652495088953; Fri, 13 May 2022 19:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652495088; cv=none; d=google.com; s=arc-20160816; b=K3V9Hjc0/PkEVspAgP/qXMfFtRYzFOQCOB9LWaWdnCaQAknZ/E4dh85Yv37K1ASTIG tvGWbXNT9hM9QqfS1LmR8vjuZu3/rcBi5rZDqv/omW3C9SVfXrWxiNegVI47ISE2xDQi T0Km7xpsfhEgKZwwFmyoeovDG+eE1bvayyNcBj5GZ7OjaljnFpDq7n0DsDdHE3aIXmJY lU2pdHQd7wkK4iF6IoZIBEM0YDyyxCIOtT4fOCzqgPo2Jp2hxz5iNboR6j7mkADjenWn QrrWs6AjAonf1KPwwOUZR+w0D0fMSfwb0j7PWFvnizajfySZB8ot4AA2H1KKtEXU5Ptu MEnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=WHAh9UufUB89p8wrDSbhPz5384xLkBNDZz0dQdBYF7w=; b=NKEbG/SA0PQXLELTgZQFw2I42SuULG9nSWgJJd42gofpFX7P0evqsjYmyZDDiYHdHd gZsWPnqIpWd8hyMK0bUdvSrPxuZ/yljje0MtWASuKO+LjpHi1vGJLasqR01/SeBZqKH2 bww0XcJVYKGMbaAanjHNhilGyVgjQy/7IBl3Z1dCnSNNWfdi9XmvTBSnYwUWhTULh3tE Fp/so26RNqSIseZ9lLbVG95vskE5VvV+UvFq023lfEv9RXqmnR5WPm0ZK/PkjKNDVcxK lIzfpsbayrKzKfQ9K4VI5ZNwmLuBz9aObC6l1bKxIwOH2F7I58OVp9YPVPbDiEGSp7Ux VTaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=lzOWB3xz; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id g1-20020adfe401000000b0020a84ea6f2esi3401867wrm.768.2022.05.13.19.24.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 19:24:48 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=lzOWB3xz; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 048794C86E0; Fri, 13 May 2022 17:40:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352239AbiEMT13 (ORCPT + 99 others); Fri, 13 May 2022 15:27:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383889AbiEMTZ7 (ORCPT ); Fri, 13 May 2022 15:25:59 -0400 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95B833206F for ; Fri, 13 May 2022 12:23:28 -0700 (PDT) Received: by mail-yb1-xb35.google.com with SMTP id j2so17047340ybu.0 for ; Fri, 13 May 2022 12:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WHAh9UufUB89p8wrDSbhPz5384xLkBNDZz0dQdBYF7w=; b=lzOWB3xzKxDXToluzqEM8In7qs9nfEIq4A+hD23ppM1L9D+w+ttUmJo9nF5Ucve+np wwWPLsvWyi+xqnCJlI8UxQQbIu4It6PhtRR3brdWTSFBnWxgDS4tV/sjam/KKT9isess nTuLbzf6ppc66fRwL3EY9mPWNOCoytqbX7qs/kaDiF5iPxQtD8kl3JFpz6eDTitKPdU2 JtJ5Rcv6H+3V3PXbqj8ktFcl4u2Ktlmd2riekIvfHukQTKWSQwYRfqepHaQN4voLcMT6 InBxVMEZVT+ZYaknIyWBuejWIBFcAdh3XZp6vH1P6po1buBUh6ogeQTEDzZ8wcvPdHzw KkIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WHAh9UufUB89p8wrDSbhPz5384xLkBNDZz0dQdBYF7w=; b=qr4N7i8i/Y7DkXwYc/ozPwZkDRGIn80FY5GvZQpJGNOS1WMzAS+7o7rjJ4PGmfrKJ0 HqbFEjXV2hkge59T3xU3Hh/NbUgl0YtWJ4jemtAkRGx/75XnB4tzxzNzKZt8br2FNbK5 aIoN4oH6KSHoPlxvW5s4aWxiszjQHDqTjkRzfXb/6hrvnx7NyxPTybZnXEJZ+ByICNQZ 7X30ygYHYLZfxGz5OU+fG9AFV7ZHSN/lWlf/9SlM/5vkYo61Xg40ELhLyVV3MaRbaidU Xrwo7omKcQ/sfbfQ5Vthxwi2mkTcD3V/c0J+ptQR+oWoZBWxae+2He/cSNJbUn/DA9bk lrRw== X-Gm-Message-State: AOAM532nso7yt0rBdDiApzCD9b4U1rDsJ1tTMw7lv4A1ID90KO86k0fj 293mBL80BCeeVJj0QQ5ONHy9Vsu/jFYRr9Uow5hu+Q== X-Received: by 2002:a25:9348:0:b0:64b:4f09:4cb6 with SMTP id g8-20020a259348000000b0064b4f094cb6mr6464930ybo.120.1652469807764; Fri, 13 May 2022 12:23:27 -0700 (PDT) MIME-Version: 1.0 References: <20220513005427.2507335-1-joshdon@google.com> In-Reply-To: From: Josh Don Date: Fri, 13 May 2022 12:23:16 -0700 Message-ID: Subject: Re: [PATCH] sched/core: add forced idle accounting for cgroups To: Tejun Heo Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel , Cruz Zhao Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 Thanks Tejun, On Thu, May 12, 2022 at 7:58 PM Tejun Heo wrote: > > On Thu, May 12, 2022 at 05:54:27PM -0700, Josh Don wrote: > > 4feee7d1260 previously added per-task forced idle accounting. This patch > > extends this to also include cgroups. > > > > rstat is used for cgroup accounting, except for the root, which uses > > kcpustat in order to bypass the need for doing an rstat flush when > > reading root stats. > > > > Only cgroup v2 is supported. Similar to the task accounting, the cgroup > > accounting requires that schedstats is enabled. > > We've been collecting scheduler stats in cgroup core so that we always have > them available whether cpu controller is enabled or not. There's nothing > actually specific to cpu controller, right? Would it make sense to collect > the cpu core stats the same way as the rest of scheduler stats? Yea, that's right, this doesn't require the cpu controller to be enabled. Are you suggesting to add a new field to cgroup_base_stat? One other weird artifact of collecting forceidle time is that a cpu may account it on behalf of its hyperthread sibling. Currently, the core rstat code always accounts to the current cpu's percpu rstat field. I can add an accounting function to support writes to a different cpu's field, in order to make sure that the per-cpu totals are correct (the forceidle accounting code holds rq->__lock, which protects all HT siblings of a core). percpu totals aren't currently exported in cgroup v2, but this is useful information that we'll consume, so it would be nice to keep it accurate. Best, Josh