Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4586159pxb; Mon, 27 Sep 2021 22:18:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlfJ7Z0Or+ObynSI0wXadT5Dfz/bWU2VsfC8faQ77JkCY2notkeuQnUaAhpUXAw9qfwd41 X-Received: by 2002:a17:90a:9285:: with SMTP id n5mr3281597pjo.29.1632806293963; Mon, 27 Sep 2021 22:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632806293; cv=none; d=google.com; s=arc-20160816; b=O7zesM3hH4964wS4N4FzVb8WYbwT5qoj4gTbtljvmnEli7yNzR094uZVq/j48EJfUY YnZN5hTNOSF6i1SC3NbrZPFqhviuF/2RpoRzzjjxhoNgtXaSJXMl3V7taUAXos80vyx0 oMlcVexI0wzhowZxwlq//JcDXxJs2JgQ9XNepwwKE70gz0F2pAQM2pIOsLSO/1IT4qri ZT+oftBk+SscQqg+ICZRmjTb+U4Oqh9aCxQeB88SjF90ATe0q/5PmJeONZ++7Q/sdMfO sPtx2F7BrRDRv9uYFPiRYUr6XA+eH2acqrkHeza9TZuznz3z9XPeFZn3Yw2ZZdo6YmMW lHEw== 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 :message-id:date:subject:cc:to:from:ironport-sdr; bh=vGDqAyzD9ivJ4mxTFUr+K2s4H3sVjTvP8/hab4CMrEw=; b=wopSk2IUth/CZFsiCYbU9yCDqSQ67jRWa1gY1B/6PgmyV87vl7CfwvyzYWjVsrtyeY yNRdG6439GSFJnuVj2/Ih9OItch9RgK5olXLAR8J1duIflepyOuQcdPLp2V963xDwVN+ g91A6ME12O3fsHjQ+SRDlCZ5dR3GLgUoufcSzrXhsvJSyb7JmtBpurGC5f9+xyyR3STF gd1Zxm62h0f3SqYGPFK9L0fNlHJC/LvKwmMBN2xZcFnwtXUNWiwkf2wtK4OdjVSbJSaG 0WsgJJyMxZtd8PiuKmEmrjT9Uvs41j8JISmZnQ20bcB37HRgsZL/1VRGoY6V+V1SWRo+ ryXA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c9si24491836pgq.163.2021.09.27.22.18.01; Mon, 27 Sep 2021 22:18:13 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234109AbhI1FR0 (ORCPT + 99 others); Tue, 28 Sep 2021 01:17:26 -0400 Received: from esa10.hc1455-7.c3s2.iphmx.com ([139.138.36.225]:24728 "EHLO esa10.hc1455-7.c3s2.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233279AbhI1FRY (ORCPT ); Tue, 28 Sep 2021 01:17:24 -0400 X-Greylist: delayed 428 seconds by postgrey-1.27 at vger.kernel.org; Tue, 28 Sep 2021 01:17:24 EDT IronPort-SDR: QE8h0f/MjikkdTDlK+FY15167lYE5vqkpTeJMBNxUEQaW5mYfCRwRELPYLz7C259TPR+7jAo1M ZOOBysg4gcicXutcQHE+ZV/qNrb9CDPzXtVZh/e57fSTVt+J/xSRmJ6HpQu0Dlhjmt3p7+LWHF Hl4bYW2a2P8GT/2l10de/HLdLuoNNuZfvRNAy/CsIBasU5jJUNBdKy7zNjQNwpUONoLgIhxcbM vkbcI7swL4j+YgvVfXdqNepjpv+NYvysXybZB19eby3IauOfPwhg4ykmOLaigi10v2A6svnVSr Jjc04ejs/6Tp/wEpqseSMrYx X-IronPort-AV: E=McAfee;i="6200,9189,10120"; a="34550053" X-IronPort-AV: E=Sophos;i="5.85,328,1624287600"; d="scan'208";a="34550053" Received: from unknown (HELO yto-r2.gw.nic.fujitsu.com) ([218.44.52.218]) by esa10.hc1455-7.c3s2.iphmx.com with ESMTP; 28 Sep 2021 14:08:19 +0900 Received: from yto-m2.gw.nic.fujitsu.com (yto-nat-yto-m2.gw.nic.fujitsu.com [192.168.83.65]) by yto-r2.gw.nic.fujitsu.com (Postfix) with ESMTP id 8FDB823A37B for ; Tue, 28 Sep 2021 14:08:18 +0900 (JST) Received: from yto-om2.fujitsu.com (yto-om2.o.css.fujitsu.com [10.128.89.163]) by yto-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id D1E18C5555 for ; Tue, 28 Sep 2021 14:08:12 +0900 (JST) Received: from pumpkin.openstacklocal (pumpkin.fct.css.fujitsu.com [10.130.70.189]) by yto-om2.fujitsu.com (Postfix) with ESMTP id BBA394007DF01; Tue, 28 Sep 2021 14:08:12 +0900 (JST) From: Hasegawa Hitomi To: frederic@kernel.org Cc: bristot@redhat.com, bsegall@google.com, dietmar.eggemann@arm.com, fweisbec@gmail.com, juri.lelli@redhat.com, linux-kernel@vger.kernel.org, mgorman@suse.de, mingo@kernel.org, peterz@infradead.org, rostedt@goodmis.org, tglx@linutronix.de, vincent.guittot@linaro.org, Hasegawa Hitomi Subject: [RFC][PATCH 0/1] sched/cputime: Improve getrusage(RUSAGE_THREAD) with nohz_full Date: Tue, 28 Sep 2021 14:08:03 +0900 Message-Id: <20210928050804.4156102-1-hasegawa-hitomi@fujitsu.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Frederic, seems busy, so I create the proper patch, would you please add your Signed-off-by: if this fix is okey. This patch is a fix proposed in the following thread [1]. The getrusage(RUSAGE_THREAD) with nohz_full returns shorter utime/stime than the actual time. In the current implementation, task_cputime_adjusted() calls task_cputime() to get the "current" utime and stime, then calls cputime_adjust () to adjust the sum of utime and stime to be equal to cputime.sum_exec_runtime. In nohz_full, sum_exec_runtime is not updated regularly, which is the cause of this discrepancy. This patch add a process to update sum_exec_runtime after getting the information from "current" and before adjusting. This addition applies only when run with nohz_full. Thanks. Hitomi Hasegawa [1] https://lore.kernel.org/lkml/OSBPR01MB21837C8931D90AE55AF4A955EB529@OSBPR01MB2183.jpnprd01.prod.outlook.com/ -- Hasegawa Hitomi (1): sched/cputime: Improve getrusage(RUSAGE_THREAD) with nohz_full include/linux/sched/cputime.h | 5 +++-- kernel/sched/cputime.c | 12 +++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) -- 2.25.1