Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1678293
| From | Rik van Riel <riel@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 5/5] sched: Accumulate vtime on top of nsec clocksource |
| Date | 2017-06-30 01:30 +0200 |
| Message-ID | <tXR2O-5WE-9@gated-at.bofh.it> (permalink) |
| References | <tXLgJ-1X8-1@gated-at.bofh.it> <tXLgK-1X8-33@gated-at.bofh.it> |
| Organization | Red Hat, Inc |
On Thu, 2017-06-29 at 19:15 +0200, Frederic Weisbecker wrote: > From: Wanpeng Li <kernellwp@gmail.com> > > Currently the cputime source used by vtime is jiffies. When we cross > a context boundary and jiffies have changed since the last snapshot, > the > pending cputime is accounted to the switching out context. > > This system works ok if the ticks are not aligned across CPUs. If > they > instead are aligned (ie: all fire at the same time) and the CPUs run > in > userspace, the jiffies change is only observed on tick exit and > therefore > the user cputime is accounted as system cputime. This is because the > CPU that maintains timekeeping fires its tick at the same time as the > others. It updates jiffies in the middle of the tick and the other > CPUs > see that update on IRQ exit: > > CPU 0 (timekeeper) CPU 1 > ------------------- ------------- > jiffies = N > ... run in userspace for a jiffy > tick entry tick entry (sees jiffies = N) > set jiffies = N + 1 > tick exit tick exit (sees jiffies = N + 1) > account 1 jiffy as > stime > > Fix this with using a nanosec clock source instead of jiffies. The > cputime is then accumulated and flushed everytime the pending delta > reaches a jiffy in order to mitigate the accounting overhead. Glad to hear this could be done without dramatically increasing the accounting overhead! > [fweisbec: changelog, rebase on struct vtime, field renames, add > delta > on cputime readers, keep idle vtime as-is (low overhead accounting), > harmonize clock sources] > > Reported-by: Luiz Capitulino <lcapitulino@redhat.com> > Suggested-by: Thomas Gleixner <tglx@linutronix.de> > Not-Yet-Signed-off-by: Wanpeng Li <kernellwp@gmail.com> > Cc: Rik van Riel <riel@redhat.com> > Cc: Peter Zijlstra <peterz@infradead.org> > Cc: Thomas Gleixner <tglx@linutronix.de> > Cc: Wanpeng Li <kernellwp@gmail.com> > Cc: Ingo Molnar <mingo@kernel.org> > Cc: Luiz Capitulino <lcapitulino@redhat.com> > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Rik van Riel <riel@redhat.com>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 0/5] vtime: Fix wrong user and system time accounting Frederic Weisbecker <fweisbec@gmail.com> - 2017-06-29 19:20 +0200
[PATCH 2/5] sched: Always set vtime_snap_whence after accounting vtime Frederic Weisbecker <fweisbec@gmail.com> - 2017-06-29 19:20 +0200
Re: [PATCH 2/5] sched: Always set vtime_snap_whence after accounting vtime Rik van Riel <riel@redhat.com> - 2017-06-30 01:10 +0200
[PATCH 5/5] sched: Accumulate vtime on top of nsec clocksource Frederic Weisbecker <fweisbec@gmail.com> - 2017-06-29 19:20 +0200
Re: [PATCH 5/5] sched: Accumulate vtime on top of nsec clocksource Rik van Riel <riel@redhat.com> - 2017-06-30 01:30 +0200
Re: [PATCH 5/5] sched: Accumulate vtime on top of nsec clocksource Wanpeng Li <kernellwp@gmail.com> - 2017-06-30 04:00 +0200
[PATCH 4/5] sched: Move vtime task fields to their own struct Frederic Weisbecker <fweisbec@gmail.com> - 2017-06-29 19:20 +0200
Re: [PATCH 4/5] sched: Move vtime task fields to their own struct Rik van Riel <riel@redhat.com> - 2017-06-30 01:10 +0200
[PATCH 1/5] vtime: Remove vtime_account_user() Frederic Weisbecker <fweisbec@gmail.com> - 2017-06-29 19:20 +0200
Re: [PATCH 1/5] vtime: Remove vtime_account_user() Rik van Riel <riel@redhat.com> - 2017-06-30 01:10 +0200
[PATCH 3/5] sched: Rename vtime fields Frederic Weisbecker <fweisbec@gmail.com> - 2017-06-29 19:20 +0200
Re: [PATCH 3/5] sched: Rename vtime fields Rik van Riel <riel@redhat.com> - 2017-06-30 01:10 +0200
Re: [RFC PATCH 0/5] vtime: Fix wrong user and system time accounting Wanpeng Li <kernellwp@gmail.com> - 2017-06-30 03:50 +0200
Re: [RFC PATCH 0/5] vtime: Fix wrong user and system time accounting Luiz Capitulino <lcapitulino@redhat.com> - 2017-06-30 19:40 +0200
Re: [RFC PATCH 0/5] vtime: Fix wrong user and system time accounting Thomas Gleixner <tglx@linutronix.de> - 2017-07-03 12:30 +0200
csiph-web