lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 19 May 2021 06:30:36 +0000
From:   "hasegawa-hitomi@...itsu.com" <hasegawa-hitomi@...itsu.com>
To:     Peter Zijlstra <peterz@...radead.org>,
        "'mingo@...nel.org'" <mingo@...nel.org>,
        "'fweisbec@...il.com'" <fweisbec@...il.com>,
        "'tglx@...utronix.de'" <tglx@...utronix.de>,
        "'juri.lelli@...hat.com'" <juri.lelli@...hat.com>,
        "'vincent.guittot@...aro.org'" <vincent.guittot@...aro.org>
CC:     "'dietmar.eggemann@....com'" <dietmar.eggemann@....com>,
        "'rostedt@...dmis.org'" <rostedt@...dmis.org>,
        "'bsegall@...gle.com'" <bsegall@...gle.com>,
        "'mgorman@...e.de'" <mgorman@...e.de>,
        "'bristot@...hat.com'" <bristot@...hat.com>,
        "'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>
Subject: Re: Utime and stime are less when getrusage (RUSAGE_THREAD) is
 executed on a tickless CPU.

Hi Ingo, Peter, Juri, and Vincent.


> Your email is malformed.

I'm sorry. I was sent in the wrong format. I correct it and resend.
Thank you, Peter, for pointing this out.


I found that when I run getrusage(RUSAGE_THREAD) on a tickless CPU,
the utime and stime I get are less than the actual time, unlike when I run
getrusage(RUSAGE_SELF) on a single thread.
This problem seems to be caused by the fact that se.sum_exec_runtime is not
updated just before getting the information from 'current'.
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. On a tickless
CPU, sum_exec_runtime is not updated periodically, so there seems to be a
discrepancy with the actual time.
Therefore, I think I should include a process to update se.sum_exec_runtime
just before getting the information from 'current' (as in other processes
except RUSAGE_THREAD). I'm thinking of the following improvement.

@@ void getrusage(struct task_struct *p, int who, struct rusage *r)
        if (who == RUSAGE_THREAD) {
+               task_sched_runtime(current);
                task_cputime_adjusted(current, &utime, &stime);

Is there any possible problem with this?


Thanks.
Hitomi Hasegawa

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ