Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3577793pxb; Mon, 24 Jan 2022 12:39:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyu5vJsauDcDxH8fhahzlAHNB8SH23ei22XQCDKo+JvIIrMC1J5nN2Sb+gBcR5CQKJY76Gu X-Received: by 2002:a63:7983:: with SMTP id u125mr12846163pgc.569.1643056776116; Mon, 24 Jan 2022 12:39:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056776; cv=none; d=google.com; s=arc-20160816; b=w2SS3sgJsAlxhF6UI3IbwRi/Q6YPV+0txPCgFsUdMql01vCUSDqDfau4P20fQMju0f o7QLl0fB1YQVO/JaFVjfH1pB6AXAb9DYpG6mrA4qVoiPe1aRzjvjL89zvyi/RcsPJCL/ D/c9aiF3TwM/zYpkyCCphISSFfNXOObQQsmgxmXatTvF1hVhFDvxyWOiCVPXcMtMGe0u 0/Ua1GiOC8Mbl7K488q8DfQ+QmQMEcVp3palXEEex1q2Kvj/+GZP/b8MVSSfUsjwGK1j XEIahb7UJf2uS9r2/eRu5OqtS7/tse7Muna21IlxhV6+1eReJWxXci6xDhgBUL8jTBBb M1Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=viOOIxvkOOLX7aSFkKXMcEtN+TfFNshJkt566ZKWyuc=; b=NC+15tdHgZ3nRM8QePJFDfE+ONtHvktpNlsinwDmSmvWb9fMvQSlVA8WTZ5+10GAtP RGKFQJfNQLetqytIpu0qQYuNqqc03WJStd0k/OM2+2oDtFTejkI4YKsDIkc+x8uTK0QN k0Gvjs2eeIJZfZ3XMGTT+hh3kDLrpwcJAMndpqN2pDlzYgB5m1DzPIXbaT1s1bCzk3s0 E6seTGgUHVOBKYjEifPf4Z2VBODSXlMcCRfAnqxucz1zxLQlcETvcEsKfqdriJH1wZU1 7B18m3Q8xBoqDUeA7f5mLK0H5R+lNuGsoEM7qTqVopeU+E5UQKP5okOgj9uatyoq3Kf4 Z8Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iFjdcqo2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p4si13472124pgn.760.2022.01.24.12.39.20; Mon, 24 Jan 2022 12:39:36 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=iFjdcqo2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358088AbiAXTyP (ORCPT + 99 others); Mon, 24 Jan 2022 14:54:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355708AbiAXTnR (ORCPT ); Mon, 24 Jan 2022 14:43:17 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05330C09426F; Mon, 24 Jan 2022 11:22:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B6D6EB81238; Mon, 24 Jan 2022 19:22:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCB4DC340E5; Mon, 24 Jan 2022 19:22:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052129; bh=RBxzockm7IGww9Gidb7iHej/D4Pfg9LdFunCed2fnb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iFjdcqo2N5JoYSHuUJdgSc7Tyk1GMDTan4xsddo5Ugz+n3aNVcbMrBKHdKx8ge8h0 npEEAfdZVTTjbQusfe/kt7kw1dfZxXZf5jEnadn/daghFPqlMq9TMjcaNalakZCn4U cYnXa1/3stjCmUJF6+248aZXiI3WhC5KcaLRHKMg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Ryabinin , "Peter Zijlstra (Intel)" , Daniel Jordan , Tejun Heo Subject: [PATCH 4.19 198/239] cputime, cpuacct: Include guest time in user time in cpuacct.stat Date: Mon, 24 Jan 2022 19:43:56 +0100 Message-Id: <20220124183949.404799676@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183943.102762895@linuxfoundation.org> References: <20220124183943.102762895@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Ryabinin commit 9731698ecb9c851f353ce2496292ff9fcea39dff upstream. cpuacct.stat in no-root cgroups shows user time without guest time included int it. This doesn't match with user time shown in root cpuacct.stat and /proc//stat. This also affects cgroup2's cpu.stat in the same way. Make account_guest_time() to add user time to cgroup's cpustat to fix this. Fixes: ef12fefabf94 ("cpuacct: add per-cgroup utime/stime statistics") Signed-off-by: Andrey Ryabinin Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Daniel Jordan Acked-by: Tejun Heo Cc: Link: https://lore.kernel.org/r/20211115164607.23784-1-arbn@yandex-team.com Signed-off-by: Greg Kroah-Hartman --- kernel/sched/cputime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -146,10 +146,10 @@ void account_guest_time(struct task_stru /* Add guest time to cpustat. */ if (task_nice(p) > 0) { - cpustat[CPUTIME_NICE] += cputime; + task_group_account_field(p, CPUTIME_NICE, cputime); cpustat[CPUTIME_GUEST_NICE] += cputime; } else { - cpustat[CPUTIME_USER] += cputime; + task_group_account_field(p, CPUTIME_USER, cputime); cpustat[CPUTIME_GUEST] += cputime; } }