From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
Oleg Nesterov <oleg@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] itimers: fix racy writes to cpu_itimer fields
Date: Thu, 24 Sep 2009 20:04:27 +0200 [thread overview]
Message-ID: <1253815467.18939.168.camel@laptop> (raw)
In-Reply-To: <20090924195732.384bea26@dhcp-lab-109.englab.brq.redhat.com>
On Thu, 2009-09-24 at 19:57 +0200, Stanislaw Gruszka wrote:
> On Thu, 24 Sep 2009 16:48:07 +0200
> Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
>
> > On Thu, 2009-09-24 at 16:35 +0200, Stanislaw Gruszka wrote:
> > > incr_error and error fields of struct cpu_itimer are used when calculating
> > > next timer tick in check_cpu_itimers() and should not be modified without
> > > tsk->sighand->siglock taken.
> >
> > Won't it be all-round much better to convert these things to hrtimers
> > instead of adding more and more fuzz on top to make them deal with
> > jiffies?
>
> Perhaps it would, but I don't know how to do it :{ . Especially how to
> precisely account user time. The only idea I have is make something like
> microstate accounting (http://lwn.net/Articles/127296/), but this patch
> and whole idea was rejected long time ago.
That patch does look a little painful indeed.
I was more thinking about about looking if an itimer was to expire less
than 1 tick away on either sched-in or the tick.
When we find it is indeed less than 1 tick away, program an hrtimer for
that cpu to expire at the required moment, see hrtick_start().
If we happen to de-schedule the task before the timer fires, we clear
the hrtimer again (or let it pend and ignore the fire), see
hrtick_clear().
[ there is no reason to rely on the tick though, we can program the
hrtimer on sched in to expire on at the right moment, and do so on each
schedule for as long as an itimer is active - re-setting whatever
pending timer the cpu still had. ]
next prev parent reply other threads:[~2009-09-24 18:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-24 14:35 [PATCH 1/2] itimers: fix racy writes to cpu_itimer fields Stanislaw Gruszka
2009-09-24 14:35 ` [PATCH 2/2] posix-cpu-timers: initialize new_itimer->it.cpu.firing Stanislaw Gruszka
2009-09-24 14:48 ` [PATCH 1/2] itimers: fix racy writes to cpu_itimer fields Peter Zijlstra
2009-09-24 17:57 ` Stanislaw Gruszka
2009-09-24 18:04 ` Peter Zijlstra [this message]
2009-09-24 20:19 ` Ingo Molnar
2009-09-30 15:05 ` Stanislaw Gruszka
2009-11-18 15:36 ` [tip:timers/urgent] itimers: Fix " tip-bot for 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=1253815467.18939.168.camel@laptop \
--to=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=sgruszka@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