Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1304701pxb; Fri, 20 Aug 2021 02:41:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYmHGo8FjWGyRF5lP9XsvvBih1Knh2l61E7RFaEQn7dlxwu9SuhTk9moXTmB/l6JXdUZlv X-Received: by 2002:aa7:c548:: with SMTP id s8mr22078490edr.162.1629452496376; Fri, 20 Aug 2021 02:41:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629452496; cv=none; d=google.com; s=arc-20160816; b=MmBkjHdw6kb6h/aBbH3WpfzJf5wa1a8seO7ToZjfOZYIv70a3stg9RWE5t+VsRqWRr EJbwnSvJecKEbUxAoXaJ+08+Ekzanvd2k4Tv1Cni/+nAMtLm/K0NYeOq9K+ygm5mDuVy YdrzygZa6tMC252LPGbBqs6lVwruyn5amd1CyyIL9/eq4WgdfzqPrufRtlZ0ly+mGYgC NBCf+OFNqL4jzt6IXA7C2ujapAC6NFcqYsB5W++CBM9K/7gxrT/9w5wWyJ3c4mtxYT66 JI6xSAs3ilKdVDoWS4/tlCzIelRH1jPh4t56Kz0Qx2xjskk7+4+Zo3vvAQws8yi8O1g/ w2RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:subject:from:dkim-signature; bh=8C0XPCFK1m41WAoGmXo4jkHrx/HebMDhC1R+WddLGDw=; b=GcNM3LNOFRg7BhPcTrfWQ24sU4A77oP3g8ZaAI74ynCKqxyr177Y7RBn83ClvxehLB 2kWhSxadjNhCEcRba9NThfyLrpPkwXELdW2JLjQq/xMy8OccBbjrbk8y1SBpjs9V7Lm/ wGFKlWnhyxXQWtDKwcV7YrIJGETumj1P+x1P9fp4v9xl4n/sDRAPnpab5ArP4Q+U584R 9Dyuaxv8x6hmLOFE8lHt3nQlFEHKCdw0jL/kKdkRj4tznKjAQYBxUe5Eh6GkWBAx/aI6 VDI1AsGLHlktileRTKV9vjjy1Mm8ZBZYxOREbQUEuvKYTjIk+Uhwr/65Mc5ljohuqJxQ 99Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex-team.com header.s=default header.b=MY+DCvNp; 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=yandex-team.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ht14si7133030ejc.296.2021.08.20.02.41.13; Fri, 20 Aug 2021 02:41:36 -0700 (PDT) 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=@yandex-team.com header.s=default header.b=MY+DCvNp; 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=yandex-team.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237044AbhHTJkW (ORCPT + 99 others); Fri, 20 Aug 2021 05:40:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233976AbhHTJkR (ORCPT ); Fri, 20 Aug 2021 05:40:17 -0400 Received: from forwardcorp1p.mail.yandex.net (forwardcorp1p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b6:217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82456C061756; Fri, 20 Aug 2021 02:39:39 -0700 (PDT) Received: from vla1-fdfb804fb3f3.qloud-c.yandex.net (vla1-fdfb804fb3f3.qloud-c.yandex.net [IPv6:2a02:6b8:c0d:3199:0:640:fdfb:804f]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id DCE882E14CF; Fri, 20 Aug 2021 12:37:19 +0300 (MSK) Received: from vla5-d6d5ce7a4718.qloud-c.yandex.net (vla5-d6d5ce7a4718.qloud-c.yandex.net [2a02:6b8:c18:341e:0:640:d6d5:ce7a]) by vla1-fdfb804fb3f3.qloud-c.yandex.net (mxbackcorp/Yandex) with ESMTP id 3xuCMsomDE-bJxCBWqM; Fri, 20 Aug 2021 12:37:19 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.com; s=default; t=1629452239; bh=8C0XPCFK1m41WAoGmXo4jkHrx/HebMDhC1R+WddLGDw=; h=In-Reply-To:References:Date:Message-ID:To:Subject:From:Cc; b=MY+DCvNp3wVLhqDJWngDFhowGQ7U9CB8IPRgLwesNuxJMSf0IR+vHk2KGbmSy9lA/ SD3rf8kjh2BTmXUPXv0ZKuYNn6+N3671nB3MSyMOBz8T0H8Cl8WblhHOuHrLsxktCl B6xep+hTFm4jL4LuU4mOUXNWOkRyzN/JlJxhzbow= Authentication-Results: vla1-fdfb804fb3f3.qloud-c.yandex.net; dkim=pass header.i=@yandex-team.com Received: from dynamic-red3.dhcp.yndx.net (dynamic-red3.dhcp.yndx.net [2a02:6b8:0:107:3e85:844d:5b1d:60a]) by vla5-d6d5ce7a4718.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id jDmq9SH3QY-bJ4GLfpc; Fri, 20 Aug 2021 12:37:19 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Andrey Ryabinin Subject: Re: [PATCH 1/4] cputime,cpuacct: Include guest time in user time in cpuacct.stat To: Daniel Jordan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Tejun Heo , Zefan Li , Johannes Weiner , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira Cc: Boris Burkov , Bharata B Rao , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20210217120004.7984-1-arbn@yandex-team.com> <87wnu5l9e6.fsf@oracle.com> Message-ID: Date: Fri, 20 Aug 2021 12:37:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <87wnu5l9e6.fsf@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sorry for abandoning this, got distracted by lots of other stuff. On 3/18/21 1:09 AM, Daniel Jordan wrote: > Andrey Ryabinin writes: > >> 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. > > Yeah, that's inconsistent. > >> Make account_guest_time() to add user time to cgroup's cpustat to >> fix this. > > Yep. > > cgroup2's cpu.stat is broken the same way for child cgroups, and this > happily fixes it. Probably deserves a mention in the changelog. > Sure. > The problem with cgroup2 was, if the workload was mostly guest time, > cpu.stat's user and system together reflected it, but it was split > unevenly across the two. I think guest time wasn't actually included in > either bucket, it was just that the little user and system time there > was got scaled up in cgroup_base_stat_cputime_show -> cputime_adjust to > match sum_exec_runtime, which did have it. > > The stats look ok now for both cgroup1 and 2. Just slightly unsure > whether we want to change the way both interfaces expose the accounting > in case something out there depends on it. Seems like we should, but > it'd be good to hear more opinions. > >> @@ -148,11 +146,11 @@ void account_guest_time(struct task_struct *p, u64 cputime) >> >> /* Add guest time to cpustat. */ >> if (task_nice(p) > 0) { >> - cpustat[CPUTIME_NICE] += cputime; >> - cpustat[CPUTIME_GUEST_NICE] += cputime; >> + task_group_account_field(p, CPUTIME_NICE, cputime); >> + task_group_account_field(p, CPUTIME_GUEST_NICE, cputime); >> } else { >> - cpustat[CPUTIME_USER] += cputime; >> - cpustat[CPUTIME_GUEST] += cputime; >> + task_group_account_field(p, CPUTIME_USER, cputime); >> + task_group_account_field(p, CPUTIME_GUEST, cputime); >> } > > Makes sense for _USER and _NICE, but it doesn't seem cgroup1 or 2 > actually use _GUEST and _GUEST_NICE. > > Could go either way. Consistency is nice, but I probably wouldn't > change the GUEST ones so people aren't confused about why they're > accounted. It's also extra cycles for nothing, even though most of the > data is probably in the cache. > Agreed, will live the _GUEST* as is.