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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22AA3C61DA4 for ; Thu, 16 Mar 2023 02:20:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229733AbjCPCUA (ORCPT ); Wed, 15 Mar 2023 22:20:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjCPCT7 (ORCPT ); Wed, 15 Mar 2023 22:19:59 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A913810ABA for ; Wed, 15 Mar 2023 19:19:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678933154; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D6EX5i+Qe8tR7m3emFCoOQSet9tLg5nf9Z6njJr0SW8=; b=OEWRZe+6MInvsoozwnM5yHyM676oTwPIyl7erbGC5l5saKFqbgCRlBkTOm2uyeoKZGLrGY zEILuXnfVp2OvYURI3BK/x6oM0/w6POIsiuM71BnykDiQEjdo8wLXBPRFUVWPmjsjpj7L6 JE16ItTbhm/siPWNY7MdgqAyteRv5Yg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-647-vs5EAvEfNtyU1kYM7NFEMQ-1; Wed, 15 Mar 2023 22:19:11 -0400 X-MC-Unique: vs5EAvEfNtyU1kYM7NFEMQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 19FC685CE66; Thu, 16 Mar 2023 02:19:11 +0000 (UTC) Received: from [10.22.34.146] (unknown [10.22.34.146]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4E882166B29; Thu, 16 Mar 2023 02:19:10 +0000 (UTC) Message-ID: Date: Wed, 15 Mar 2023 22:19:10 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH] cgroup: fix display of forceidle time at root Content-Language: en-US To: Josh Don , Tejun Heo , Zefan Li , Johannes Weiner Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230315214029.899573-1-joshdon@google.com> From: Waiman Long In-Reply-To: <20230315214029.899573-1-joshdon@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/15/23 17:40, Josh Don wrote: > 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; How about adding the following fixes tag? Fixes: 1fcf54deb767 ("sched/core: add forced idle accounting for cgroups") Cheers, Longman