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: Thomas Gleixner <tglx@linutronix.de>,
	Oleg Nesterov <oleg@redhat.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] itimers: periodic timers fixes
Date: Wed, 15 Apr 2009 14:22:32 +0200	[thread overview]
Message-ID: <20090415142232.46a97f70@dhcp-lab-109.englab.brq.redhat.com> (raw)
In-Reply-To: <20090402165753.GA12793@elte.hu>

Hi Ingo.

On Thu, 2 Apr 2009 18:57:53 +0200
Ingo Molnar <mingo@elte.hu> wrote:
> > We found the periodic timers ITIMER_PROF and ITIMER_VIRT are 
> > unreliable, they have systematic timing error. For example period 
> > of 10000 us will not be represented by the kernel as 10 ticks, but 
> > 11 (for HZ=1000). The reason is that the frequency of the hardware 
> > timer can only be chosen in discrete steps and the actual 
> > frequency is about 1000.152 Hz. So 10 ticks would take only about 
> > 9.9985 ms, the kernel decides it must never return earlier than 
> > requested, so it rounds the period up to 11 ticks. This results in 
> > a systematic multiplicative timing error of -10 %. The situation 
> > is even worse where application try to request with 1 thick 
> > period. It will get the signal once per two kernel ticks, not on 
> > every tick. The systematic multiplicative timing error is -50 %. 
> > He have program [1] that shows itimers systematic error, results 
> > are below [2].
> > 
> > To fix situation we wrote two patches. First one just simplify 
> > code related with itimers. Second is fix, it change intervals 
> > measurement resolutions and correct times when signal is 
> > generated. However this add some drawback, that I'm not sure if 
> > are acceptable:
> > 
> > - the time between two consecutive tics can be smaller than 
> >   requested interval
> > 
> > - intervals values which are returned to user by getitimer() are 
> >   not rounded up
> > 
> > Second drawback mean that applications which first call 
> > setitimer() then call getitimer() to see if interval was round up 
> > and to correct timings, will potentially stop works. However this 
> > can be only problem with requested interval smaller than 1/HZ, as 
> > for intervals > 1/Hz we can generate signals with proper 
> > resolution.
> 
> Converting those to GTOD sampling instead of jiffies sampling is a 
> worthwile change IMO and a good concept.
> 
> The unificaton of ITIMER_PROF and ITIMER_VIRT is a nice observation 
> and a good patch.
> 
> The second one, changing all the sampling from cputime to ktime_t is 
> nicely done too:
> 
> We could do more though, there's still a bit of cputime legacies 
> around:
> 
> +	cputime_t cval, nval;
> 
> Couldnt all of that go over into the ktime_t space as well, phasing 
> out cputime logic from the itimer code?
> 
> The user ABI is struct timeval based, so there's no need to have 
> cputime anywhere. The scheduler does nanoseconds accurate stats so 
> it can be connected up there too.

Could the patches be merged and possible other work done in later time?
Or perhaps I should rework on them?

Regards
Stanislaw

  parent reply	other threads:[~2009-04-15 12:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-02 12:11 Stanislaw Gruszka
2009-04-02 16:57 ` Ingo Molnar
2009-04-03 12:59   ` Stanislaw Gruszka
2009-04-15 12:22   ` Stanislaw Gruszka [this message]
2009-04-15 13:59     ` Ingo Molnar
2009-04-15 14:02       ` Oleg Nesterov
2009-05-12 21:11       ` Thomas Gleixner
2009-05-13 12:55         ` Ingo Molnar
2009-05-14 13:39         ` Stanislaw Gruszka
2009-05-14 13:54           ` Thomas Gleixner

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=20090415142232.46a97f70@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®