From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932673AbdC2NYC (ORCPT ); Wed, 29 Mar 2017 09:24:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39636 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753680AbdC2NYA (ORCPT ); Wed, 29 Mar 2017 09:24:00 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 450B07FD47 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lcapitulino@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 450B07FD47 Date: Wed, 29 Mar 2017 09:23:57 -0400 From: Luiz Capitulino To: Rik van Riel Cc: Frederic Weisbecker , linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, Wanpeng Li Subject: Re: [BUG nohz]: wrong user and system time accounting Message-ID: <20170329092357.2ca784c2@redhat.com> In-Reply-To: <1490793272.28917.5.camel@redhat.com> References: <20170323165512.60945ac6@redhat.com> <20170329130447.GB8306@lerouge> <1490793272.28917.5.camel@redhat.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/VnTC34nrF2nX6Xsaw90i5U3" X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 29 Mar 2017 13:23:59 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --MP_/VnTC34nrF2nX6Xsaw90i5U3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Wed, 29 Mar 2017 09:14:32 -0400 Rik van Riel wrote: > > I failed to reproduce with your config. I'm still getting 99% > > userspace > > cputime. So I'm wondering if the hogging style plays a role. > >=20 > > I run pure user loops: > >=20 > > =C2=A0=C2=A0=C2=A0=C2=A0int main(int argc, char **argv) > > =C2=A0=C2=A0=C2=A0=C2=A0{ > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0for (;;); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return 0 > > =C2=A0=C2=A0=C2=A0=C2=A0} > >=20 > > Does your user program perform syscalls or IOs of some sort? =20 >=20 > Luiz's program makes a syscall every millisecond, > if started with the arguments he gave as his > reproducer. 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. --MP_/VnTC34nrF2nX6Xsaw90i5U3 Content-Type: text/x-c++src Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=hog.c #define _GNU_SOURCE #include #include #include #include #include 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; } --MP_/VnTC34nrF2nX6Xsaw90i5U3--