Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1608072

Re: [BUG nohz]: wrong user and system time accounting

Path csiph.com!weretis.net!feeder4.news.weretis.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Wanpeng Li <kernellwp@gmail.com>
Newsgroups linux.kernel
Subject Re: [BUG nohz]: wrong user and system time accounting
Date Fri, 24 Mar 2017 03:00:02 +0100
Message-ID <tomGe-2CL-19@gated-at.bofh.it> (permalink)
References <tohZT-7Mb-5@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=idR6kZVSEQxbxCj3WbkgcDPyWZzI2r5KqIsHECRThDM=; b=TpObH+TNEB2FJl4+TYj3NiylORP1FIgqfbG3jmeOtI0jEGXA3CKl/wTqlub3gsGSWN FMQNAI57hRcFdSd9TN4J+PPhT7aXeavAQxPYKTBYJdKmZzlQwz3HHskQnYSQTOhtGOmb YOWlVIit4o/K+M21XSIP7jbxckdspqgB5AAONXqh08IDA/KVhMHZ4lgEkQSX8rkV6A4B wpGSW3NXM0VZkzLESpeT5FdJ8OXc9Bgms7VQ1O2SGzzb+bRRwe57WHjqHaPzdJsXXtA9 agkqFgW0PA7r+oMGrHiAlSzi+PimpcAQ6j9VRr4w+fy8+sTiN7mJUg7M0ThDqHZNKgJq vs6A==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=idR6kZVSEQxbxCj3WbkgcDPyWZzI2r5KqIsHECRThDM=; b=JeDTJsvtMn+yv7ctmz2JLnRTBIw8rI6eRBgLpuW3hvzfXftw7abHhrHla40F6qvtjh H4PpAndc1JrsPklr1JfkVr5x54iX/eaK5htOKVE/kANu2rV75go811exLbR93MGCzLp7 bTzfQdiBD6dPhryW5lU9sxCq9fEKzjTYPHx5hwBsQTGQLOLF/aZAJLElJ+xEpmC8lzTB Q3jBWacr1gIAQ6V0Z9+gcuTGTX2oZhPjjQGDHkDpq/Cn28pxc1cLyMkWlVjx/hk4fjQ2 s1qB7k7zx2Rrds6ZZpk5ZgBwuJlPgBmnE7zEQ9X/jX3nBcKH6rVc+1YL6iOrqQtZ9l91 QGKQ==
X-Gm-Message-State AFeK/H2Ro1KGp2XNgHB3GfD0vXaXXR6mhHJt/BGfRPrQcRYLTndvaAvK+QMXcSL2HEMUw8JuoSRPYaReYLTZ+g==
X-Received by 10.28.150.136 with SMTP id y130mr471301wmd.103.1490320331689; Thu, 23 Mar 2017 18:52:11 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 65
Organization linux.* mail to news gateway
X-Original-Cc Frederic Weisbecker <fweisbec@gmail.com>, Rik van Riel <riel@redhat.com>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, linux-rt-users@vger.kernel.org
X-Original-Date Fri, 24 Mar 2017 09:52:11 +0800
X-Original-Message-ID <CANRm+Cw3gA0RrKoccovLxbdxfQ60TO=OSsrkC7bzZLcn4Bhcyw@mail.gmail.com>
X-Original-References <20170323165512.60945ac6@redhat.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1608072

Show key headers only | View raw


2017-03-24 4:55 GMT+08:00 Luiz Capitulino <lcapitulino@redhat.com>:
>
> When there are two or more tasks executing in user-space and
> taking 100% of a nohz_full CPU, top reports 70% system time
> and 30% user time utilization. Sometimes I'm even able to get
> 100% system time and 0% user time.
>
> This was reproduced with latest Linus tree (093b995), but I
> don't believe it's a regression (at least not a recent one)
> as I can reproduce it with older kernels. Also, I have
> CONFIG_IRQ_TIME_ACCOUNTING=y and haven't tried to reproduce
> without it yet.
>
> Below you'll find the steps to reproduce and some initial
> analysis.
>
> Steps to reproduce
> ------------------
>
> 1. Set up a CPU for nohz_full with isolcpus= nohz_full=
>
> 2. Pin two tasks that hog the CPU 100% of the time to that CPU
>
> 3. Run top -d1 and check system time
>
> NOTE: When there's only one task hogging a nohz_full CPU, top
>       shows 100% user-time, as expected

I just saw at most 12% system time instead of 30% or 100%. Could you
grep HZ /boot/config-`uname -r` and post here?

Regards,
Wanpeng Li

>
> Initial analysis
> ----------------
>
> When tracing vtime accounting functions and the user-space/kernel
> transitions when the issue is taking place, I see several of the
> following:
>
> hog-10552 [015]  1132.711104: function:             enter_from_user_mode <-- apic_timer_interrupt
> hog-10552 [015]  1132.711105: function:             __context_tracking_exit <-- enter_from_user_mode
> hog-10552 [015]  1132.711105: bprint:               __context_tracking_exit.part.4: new state=1 cur state=1 active=1
> hog-10552 [015]  1132.711105: function:             vtime_account_user <-- __context_tracking_exit.part.4
> hog-10552 [015]  1132.711105: function:             smp_apic_timer_interrupt <-- apic_timer_interrupt
> hog-10552 [015]  1132.711106: function:             irq_enter <-- smp_apic_timer_interrupt
> hog-10552 [015]  1132.711106: function:             tick_sched_timer <-- __hrtimer_run_queues
> hog-10552 [015]  1132.711108: function:             irq_exit <-- smp_apic_timer_interrupt
> hog-10552 [015]  1132.711108: function:             __context_tracking_enter <-- prepare_exit_to_usermode
> hog-10552 [015]  1132.711108: bprint:               __context_tracking_enter.part.2: new state=1 cur state=0 active=1
> hog-10552 [015]  1132.711109: function:             vtime_user_enter <-- __context_tracking_enter.part.2
> hog-10552 [015]  1132.711109: function:             __vtime_account_system <-- vtime_user_enter
> hog-10552 [015]  1132.711109: function:             account_system_time <-- __vtime_account_system
>
> On entering the kernel due to a timer interrupt, vtime_account_user()
> skips user-time accounting. Then later on when returning to user-space,
> vtime_user_enter() is probably accounting the whole time (ie. user-space
> plus kernel-space) to system time.
>
> Now, when does vtime_account_user() skips accounting? Well, when the
> time delta is less then one jiffie. This would imply that vtime_account_user()
> is being called less than one jiffie since the last accounting, but I haven't
> confirmed any of this yet.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[BUG nohz]: wrong user and system time accounting Luiz Capitulino <lcapitulino@redhat.com> - 2017-03-23 22:00 +0100
  Re: [BUG nohz]: wrong user and system time accounting Rik van Riel <riel@redhat.com> - 2017-03-24 02:00 +0100
    Re: [BUG nohz]: wrong user and system time accounting Luiz Capitulino <lcapitulino@redhat.com> - 2017-03-24 02:10 +0100
      Re: [BUG nohz]: wrong user and system time accounting Rik van Riel <riel@redhat.com> - 2017-03-24 02:10 +0100
        Re: [BUG nohz]: wrong user and system time accounting Luiz Capitulino <lcapitulino@redhat.com> - 2017-03-24 02:50 +0100
    Re: [BUG nohz]: wrong user and system time accounting lkml@pengaru.com - 2017-03-27 07:40 +0200
  Re: [BUG nohz]: wrong user and system time accounting Wanpeng Li <kernellwp@gmail.com> - 2017-03-24 03:00 +0100
  Re: [BUG nohz]: wrong user and system time accounting Wanpeng Li <kernellwp@gmail.com> - 2017-03-27 04:00 +0200

csiph-web