From patchwork Wed Mar 15 21:40:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Don X-Patchwork-Id: 70477 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp148055wrt; Wed, 15 Mar 2023 15:07:16 -0700 (PDT) X-Google-Smtp-Source: AK7set++lVwwir41vzEc7xRxHsEBHDrqcgBUFNV2URwI8rT8MAwC7rWPy5Cco/vEtclNUiwjfMbd X-Received: by 2002:a17:902:d10a:b0:19e:9807:de48 with SMTP id w10-20020a170902d10a00b0019e9807de48mr768014plw.23.1678918036171; Wed, 15 Mar 2023 15:07:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678918036; cv=none; d=google.com; s=arc-20160816; b=kAp+rQFxA5HiJ9QuqfTNnEqga4YlOP8FyvjXqsF+xEGEool5idwVxqb+7aBqLNdlmX kM/aSobgP6R6/F5WIUbwgqBa61CBkgRRxdunSvzQ06/BTy2NjZGJANp99f0n/3+Z8h4f p/euY7lOjJ2qY5FqyvTGk8I7Gpxf6rSc7O8DklWfZxNZsDERJVEQ6hlVRQxAGf+GXsZx nASNWhD1RPB9xJpEer4F/jvsoToHR/Pf0J07pum/Wp6D9lnhviLc6q9h59G3oMYr4h12 mQozl3a6Gjv/dH6TL66rhIdWDkl4MAplETBnPaKgA2X/fMtbVyMj1AUvL11tPBtNRofZ qtIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=0vT5pZgC3odOnq/dCWudlRqWXNT/3pXxM4U4p7g/Zps=; b=i0JqdvcKfvnP8ejJpHh5cs+3sc+5e3QjQAa6/47XFzXpMQtTsxZ8BXpg6UFCiinQpj Q/0TCazr19OhhW0An4/4UbQIUCD2yxzjFRvKJNQRU2Kc1irPLzJ7PGfNpvbcGJwdi7cC 3WOgHRRYsp2ubmpVuNdvVetYKQ5TiixDg6zbA7DDA8vlmzpDyuInKZ+QXc7dhOBnK7w7 +GlZLi359bvzS+XYt7wbxRFWihYHwHxF1AVohD3UqvjT8V5DjgEfRXQlBUz+6qMkyKXY U/D+zDRp7uroTvik3oz6pjF2zpgE5kLewwhsuLKMgl10RJEjeGoOF+Q9gBTVbJIGQLfD A1bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=GBOhli6D; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jd2-20020a170903260200b0019b354d0268si6328511plb.280.2023.03.15.15.07.02; Wed, 15 Mar 2023 15:07:16 -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=@google.com header.s=20210112 header.b=GBOhli6D; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232690AbjCOVkg (ORCPT + 99 others); Wed, 15 Mar 2023 17:40:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232400AbjCOVkf (ORCPT ); Wed, 15 Mar 2023 17:40:35 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AEC7559E for ; Wed, 15 Mar 2023 14:40:34 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-541a39df9f4so105547817b3.20 for ; Wed, 15 Mar 2023 14:40:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1678916433; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=0vT5pZgC3odOnq/dCWudlRqWXNT/3pXxM4U4p7g/Zps=; b=GBOhli6DgB6C2e3UwLY3hOUyIJJCYvBv89mVgUJNI9rwDtzV+xfm8MeOiM6FEn49Og dac3udvhEPDGv68VxZ6KhmgYa4bE5Dz2pnI3o8WNC7zwpdH+SXm0yGK2BrWrxEibNsx8 QKnsQoEIsXs+afDVgCAFeywJEHRVjsD4xI8bX3UKIZ4GhZqHkz0b+XtP5oLct1tiKV/F iYR9De56Y/qllKPi2/15D5E/kuCmnylV9fo3Kt/lp51pvJt+dzgVvcEIMWJNH5RgUhn3 wmDFBrCXDyMivyyL/lELOeFVcxU8TifaiKU3oAM6dlFLK+vrPqZNEe2nDCphqMJtMcz7 t7tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678916433; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=0vT5pZgC3odOnq/dCWudlRqWXNT/3pXxM4U4p7g/Zps=; b=dhoY56DtDIbpYGgg5dBjm+41rACsAX7ecR+xPyssNvr6dWno7MJjOEkr7TyUkkfbIS D2EQMktlao38Ic9KvgOvOq1BXaw+FACOD9dmEHvn8Z3QNaifNHDzcaNqdMsOgimPiPW7 dc/mAXnQ9SvZY7ToKsefR30t+kBiGQTtmwqj4QdkuGHLzvBEEsh0UMiVXf5KajjlZjSn H+oHSdTDkV68/qyfa/0jMJ/b/q1y0SX6Fn501DptaLutPRWm++to7h9N+2UFGeN2afuQ f50P2wfSrJXnU6yQ+tnyzaQ2xRMJ3UN1RTfoHGGRW32H3iAUUoBJ1SQIK2+7Z9w4UvA+ QHdg== X-Gm-Message-State: AO0yUKVJ0STY1O/uEXcfDPOEPJznIfewtb27z3AkuHBGRNRig8/x8eBF mxYti57ganQIZx8prBHiLkYz9Wjfzeyd X-Received: from joshdon-desktop.svl.corp.google.com ([2620:15c:2d4:203:d03e:7c5d:386a:dce3]) (user=joshdon job=sendgmr) by 2002:a05:690c:68d:b0:521:daa4:d687 with SMTP id bp13-20020a05690c068d00b00521daa4d687mr1098786ywb.0.1678916433410; Wed, 15 Mar 2023 14:40:33 -0700 (PDT) Date: Wed, 15 Mar 2023 14:40:29 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog Message-ID: <20230315214029.899573-1-joshdon@google.com> Subject: [PATCH] cgroup: fix display of forceidle time at root From: Josh Don To: Tejun Heo , Zefan Li , Johannes Weiner Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Josh Don X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760473158508635344?= X-GMAIL-MSGID: =?utf-8?q?1760473158508635344?= We need to reset forceidle_sum to 0 when reading from root, since the bstat we accumulate into is stack allocated. To make this more robust, just replace the existing cputime reset with a memset of the overall bstat. Signed-off-by: Josh Don --- kernel/cgroup/rstat.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c index 831f1f472bb8..0a2b4967e333 100644 --- a/kernel/cgroup/rstat.c +++ b/kernel/cgroup/rstat.c @@ -457,9 +457,7 @@ static void root_cgroup_cputime(struct cgroup_base_stat *bstat) struct task_cputime *cputime = &bstat->cputime; int i; - cputime->stime = 0; - cputime->utime = 0; - cputime->sum_exec_runtime = 0; + memset(bstat, 0, sizeof(*bstat)); for_each_possible_cpu(i) { struct kernel_cpustat kcpustat; u64 *cpustat = kcpustat.cpustat;