[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170329214807.6ae3b7c8@redhat.com>
Date: Wed, 29 Mar 2017 21:48:07 -0400
From: Luiz Capitulino <lcapitulino@...hat.com>
To: Frederic Weisbecker <fweisbec@...il.com>
Cc: Rik van Riel <riel@...hat.com>, linux-kernel@...r.kernel.org,
linux-rt-users@...r.kernel.org, Wanpeng Li <kernellwp@...il.com>
Subject: Re: [BUG nohz]: wrong user and system time accounting
On Wed, 29 Mar 2017 23:12:00 +0200
Frederic Weisbecker <fweisbec@...il.com> wrote:
> 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.
Are you running on x86? My CPU is:
Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz
I wonder if this issue depends on the timer used by the hrtimer
subsystem.
Powered by blists - more mailing lists