mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <sgruszka@redhat.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, Oleg Nesterov <oleg@redhat.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH -tip 0/1] posix-cpu-timers: fix CPUCLOCK_{PROF,VIRT} periodic tics precision
Date: Wed, 12 Aug 2009 10:13:52 +0200	[thread overview]
Message-ID: <20090812101352.22569b5a@dhcp-lab-109.englab.brq.redhat.com> (raw)
In-Reply-To: <1250001100-3936-1-git-send-email-sgruszka@redhat.com>

On Tue, 11 Aug 2009 16:31:39 +0200
Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> POSIX 1.b cpu timers where clockid is based on CPUCLOCK_PROF and CPUCLOCK_VIRT,
> have systematic timer error, the same as had itimers. Error can be showed by
> program [1]. Results for unpatched and patched kernel are below:
> 
> Unpatched kernel:
> 
> CLK_PROF
> Period 10000:	counted time 14.51 , real time 15.99 , error -9.2 %
> Period 9998:	counted time 15.95 , real time 15.96 , error -0.1 %
> Period 1000:	counted time 7.99 , real time 15.98 , error -50.0 %
> Period 11111:	counted time 14.77 , real time 15.96 , error -7.5 %
> Period 21315:	counted time 15.45 , real time 15.96 , error -3.1 %
> Period 1500:	counted time 11.98 , real time 15.98 , error -25.0 %
> Period 15000:	counted time 14.96 , real time 15.96 , error -6.3 %
> Period 50000:	counted time 15.60 , real time 15.95 , error -2.2 %
> Period 777777:	counted time 15.56 , real time 15.95 , error -2.5 %
> Period 212341:	counted time 15.71 , real time 15.95 , error -1.5 %
> Period 10001:	counted time 14.50 , real time 15.96 , error -9.1 %
> Period 1002:	counted time 8.01 , real time 15.98 , error -49.9 %
> Period 999000:	counted time 14.98 , real time 15.95 , error -6.1 %
> Period 2222:	counted time 11.83 , real time 15.97 , error -26.0 %
> Period 500:	counted time 8.01 , real time 16.02 , error -50.0 %
> CLK_VIRT
> Period 10000:	counted time 14.50 , real time 15.96 , error -9.2 %
> Period 9998:	counted time 15.95 , real time 15.96 , error -0.1 %
> Period 1000:	counted time 7.99 , real time 15.98 , error -50.0 %
> Period 11111:	counted time 14.77 , real time 15.97 , error -7.5 %
> Period 21315:	counted time 15.45 , real time 15.96 , error -3.2 %
> Period 1500:	counted time 11.99 , real time 15.99 , error -25.0 %
> Period 15000:	counted time 14.96 , real time 15.96 , error -6.3 %
> Period 50000:	counted time 15.60 , real time 15.96 , error -2.2 %
> Period 777777:	counted time 15.56 , real time 15.95 , error -2.5 %
> Period 212341:	counted time 15.71 , real time 15.96 , error -1.5 %
> Period 10001:	counted time 14.50 , real time 15.96 , error -9.1 %
> Period 1002:	counted time 8.01 , real time 15.99 , error -49.9 %
> Period 999000:	counted time 14.98 , real time 15.95 , error -6.1 %
> Period 2222:	counted time 11.83 , real time 15.98 , error -26.0 %
> Period 500:	counted time 8.01 , real time 16.01 , error -50.0 %
> 
> Patched kernel:
> 
> CLK_PROF
> Period 10000:	counted time 16.05 , real time 16.06 , error -0.1 %
> Period 9998:	counted time 16.30 , real time 16.30 , error -0.0 %
> Period 1000:	counted time 16.45 , real time 16.45 , error -0.0 %
> Period 11111:	counted time 15.99 , real time 16.00 , error -0.1 %
> Period 21315:	counted time 15.99 , real time 15.99 , error -0.1 %
> Period 1500:	counted time 16.03 , real time 16.03 , error -0.0 %
> Period 15000:	counted time 15.99 , real time 16.00 , error -0.0 %
> Period 50000:	counted time 15.95 , real time 15.99 , error -0.3 %
> Period 777777:	counted time 15.56 , real time 15.99 , error -2.7 %
> Period 212341:	counted time 16.35 , real time 16.37 , error -0.1 %
> Period 10001:	counted time 15.99 , real time 16.00 , error -0.0 %
> Period 1002:	counted time 16.05 , real time 16.05 , error -0.0 %
> Period 999000:	counted time 15.98 , real time 15.99 , error -0.1 %
> Period 2222:	counted time 16.02 , real time 16.02 , error -0.0 %
> Period 500:	counted time 8.02 , real time 16.05 , error -50.0 %
> CLK_VIRT
> Period 10000:	counted time 15.99 , real time 16.00 , error -0.1 %
> Period 9998:	counted time 16.02 , real time 16.03 , error -0.1 %
> Period 1000:	counted time 16.04 , real time 16.05 , error -0.1 %
> Period 11111:	counted time 15.99 , real time 16.00 , error -0.1 %
> Period 21315:	counted time 16.39 , real time 16.40 , error -0.1 %
> Period 1500:	counted time 16.02 , real time 16.03 , error -0.0 %
> Period 15000:	counted time 15.97 , real time 16.00 , error -0.1 %
> Period 50000:	counted time 15.95 , real time 16.00 , error -0.3 %
> Period 777777:	counted time 15.56 , real time 16.00 , error -2.8 %
> Period 212341:	counted time 16.14 , real time 16.34 , error -1.2 %
> Period 10001:	counted time 15.98 , real time 16.00 , error -0.1 %
> Period 1002:	counted time 16.04 , real time 16.05 , error -0.0 %
> Period 999000:	counted time 15.98 , real time 16.00 , error -0.1 %
> Period 2222:	counted time 16.01 , real time 16.02 , error -0.1 %
> Period 500:	counted time 8.02 , real time 16.05 , error -50.0 %
> 
> Even if probably nobody use these timers, I think we should fix them
> because we have this API in kernel and the timers perform bad. Patch
> is against Ingo's -tip (-sched-devel) tree where are my previous itmiers
> patches.

I tested my patch on ppc64 and sadly it is broken. I get this output
for patched kernel:

CLK_PROF
Period 10000:   counted time 46.24 , real time 41.63 , error 11.1 %
Period 9998:    counted time 46.24 , real time 41.63 , error 11.1 %
Period 1000:    counted time 42.01 , real time 42.50 , error -1.2 %
Period 11111:   counted time 45.72 , real time 41.63 , error 9.8 %
Period 21315:   counted time 43.65 , real time 41.62 , error 4.9 %
Period 1500:    counted time 63.26 , real time 42.48 , error 48.9 %
Period 15000:   counted time 44.53 , real time 41.59 , error 7.1 %
Period 50000:   counted time 42.40 , real time 41.58 , error 2.0 %
Period 777777:  counted time 41.22 , real time 41.57 , error -0.8 %
Period 212341:  counted time 41.62 , real time 41.57 , error 0.1 %
Period 10001:   counted time 46.22 , real time 41.62 , error 11.1 %
Period 1002:    counted time 42.52 , real time 42.46 , error 0.1 %
Period 999000:  counted time 40.96 , real time 41.63 , error -1.6 %
Period 2222:    counted time 76.01 , real time 42.31 , error 79.6 %
Period 500:     counted time 21.16 , real time 42.46 , error -50.2 %
CLK_VIRT
Period 10000:   counted time 45.68 , real time 41.65 , error 9.7 %
Period 9998:    counted time 45.66 , real time 41.77 , error 9.3 %
Period 1000:    counted time 41.89 , real time 42.40 , error -1.2 %
Period 11111:   counted time 45.17 , real time 41.63 , error 8.5 %
Period 21315:   counted time 43.10 , real time 41.60 , error 3.6 %
Period 1500:    counted time 63.10 , real time 42.57 , error 48.2 %
Period 15000:   counted time 44.04 , real time 41.62 , error 5.8 %
Period 50000:   counted time 41.90 , real time 41.61 , error 0.7 %
Period 777777:  counted time 40.44 , real time 41.62 , error -2.8 %
Period 212341:  counted time 41.19 , real time 41.60 , error -1.0 %
Period 10001:   counted time 45.66 , real time 41.64 , error 9.7 %
Period 1002:    counted time 41.74 , real time 42.52 , error -1.8 %
Period 999000:  counted time 40.96 , real time 41.70 , error -1.8 %
Period 2222:    counted time 75.50 , real time 42.32 , error 78.4 %
Period 500:     counted time 21.11 , real time 42.56 , error -50.4 %

Signals are generated more frequent than should. I guess I'm doing something
wrong with cputime_to_jiffies() and/or jiffies_to_cputime(), but as far I'm
not sure were the bug is.

Anyway, please forgot about the patch as long as I figure this out.

  parent reply	other threads:[~2009-08-12  8:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-11 14:31 Stanislaw Gruszka
2009-08-11 14:31 ` [PATCH -tip 1/1] " Stanislaw Gruszka
2009-08-12  8:13 ` Stanislaw Gruszka [this message]
2009-09-08 14:40 ` [PATCH -tip 0/1] posix-cpu-timers: fix CPUCLOCK_{PROF,VIRT} periodic tics precision -v1 Stanislaw Gruszka
2009-09-08 14:40   ` [PATCH -tip 1/1] " Stanislaw Gruszka

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=20090812101352.22569b5a@dhcp-lab-109.englab.brq.redhat.com \
    --to=sgruszka@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®