From: Frederic Weisbecker <fweisbec@gmail.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Rik van Riel <riel@redhat.com>,
linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org,
Wanpeng Li <kernellwp@gmail.com>
Subject: Re: [BUG nohz]: wrong user and system time accounting
Date: Wed, 29 Mar 2017 23:12:00 +0200 [thread overview]
Message-ID: <20170329211159.GA23895@lerouge> (raw)
In-Reply-To: <20170329092357.2ca784c2@redhat.com>
On Wed, Mar 29, 2017 at 09:23:57AM -0400, Luiz Capitulino wrote:
>
> There are various reproducers actually. I started off with the simple
> loop above, then wrote the attach program and then wrote the one
> you're mentioning:
>
> http://people.redhat.com/~lcapitul/real-time/acct-bug.c
>
> All of them reproduce the issue 100% of the time for me.
> #define _GNU_SOURCE
> #include <stdio.h>
> #include <unistd.h>
> #include <stdlib.h>
> #include <sched.h>
> #include <sys/types.h>
>
> static int move_to_cpu(int cpu)
> {
> cpu_set_t set;
>
> CPU_ZERO(&set);
> CPU_SET(cpu, &set);
> return sched_setaffinity(0, sizeof(set), &set);
> }
>
> static void loop(void)
> {
> for (;;) ;
> }
>
> static int fork_hog(int cpu)
> {
> int pid;
>
> pid = (int) fork();
> if (pid == 0) {
> move_to_cpu(cpu);
> loop();
> exit(0);
> }
>
> return pid;
> }
>
> int main(int argc, char *argv[])
> {
> int i, pid, cpu, nr_procs;
>
> if (argc != 3) {
> printf("usage: hog < nr-procs > < CPU >\n");
> exit(1);
> }
>
> cpu = atoi(argv[2]);
> nr_procs = atoi(argv[1]);
>
> for (i = 0; i < nr_procs; i++) {
> pid = fork_hog(cpu);
> fprintf(stderr, "created hog%d pid=%d\n", i, pid);
> }
>
> fprintf(stderr, "pausing...\n");
> pause();
>
> return 0;
> }
I just tried both of these and none seem to show incorrect cputime :-/
I'm wondering if that bug depends on some hardware.
next prev parent reply other threads:[~2017-03-29 21:12 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-23 20:55 [BUG nohz]: wrong user and system time accounting Luiz Capitulino
2017-03-24 0:56 ` Rik van Riel
2017-03-24 1:05 ` Luiz Capitulino
2017-03-24 1:08 ` Rik van Riel
2017-03-24 1:39 ` Luiz Capitulino
2017-03-27 5:33 ` lkml
2017-03-24 1:52 ` Wanpeng Li
2017-03-24 3:56 ` Luiz Capitulino
2017-03-27 1:56 ` Wanpeng Li
2017-03-27 17:35 ` Rik van Riel
2017-03-28 7:19 ` Wanpeng Li
[not found] ` <20170328132406.7d23579c@redhat.com>
[not found] ` <20170329131656.1d6cb743@redhat.com>
[not found] ` <20170329221700.GB23895@lerouge>
2017-03-29 22:46 ` Wanpeng Li
2017-03-30 2:14 ` Luiz Capitulino
2017-03-30 12:27 ` Wanpeng Li
2017-03-27 18:38 ` Luiz Capitulino
2017-03-28 5:28 ` Wanpeng Li
2017-03-28 13:44 ` Luiz Capitulino
2017-03-29 13:04 ` Frederic Weisbecker
2017-03-29 13:14 ` Rik van Riel
2017-03-29 13:23 ` Luiz Capitulino
2017-03-29 21:12 ` Frederic Weisbecker [this message]
2017-03-30 1:48 ` Luiz Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170329211159.GA23895@lerouge \
--to=fweisbec@gmail.com \
--cc=kernellwp@gmail.com \
--cc=lcapitulino@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=riel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).