public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: George Anzinger <george@mvista.com>
To: "Liu, Hong" <hong.liu@intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6] fix POSIX timers expire before their scheduled time
Date: Wed, 16 Mar 2005 22:29:45 -0800	[thread overview]
Message-ID: <423923D9.4050801@mvista.com> (raw)
In-Reply-To: <1111026022.2994.54.camel@devlinux-hong>

Liu, Hong wrote:
> POSIX says: POSIX timers should not expire before their scheduled time.
> 
> Due to the timer started between jiffies, there are cases that the timer
> will expire before its scheduled time.
> This patch ensures timers will not expire early.
> 
> --- a/kernel/posix-timers.c     2005-03-10 15:46:27.329333664 +0800
> +++ b/kernel/posix-timers.c     2005-03-10 15:50:11.884196136 +0800
> @@ -957,7 +957,8 @@
>                             &expire_64, &(timr->wall_to_prev))) {
>                 return -EINVAL;
>         }
> -       timr->it_timer.expires = (unsigned long)expire_64;
> +       timr->it_timer.expires = (unsigned long)expire_64 + 1;
>         tstojiffie(&new_setting->it_interval, clock->res, &expire_64);
>         timr->it_incr = (unsigned long)expire_64;
> 
Has this happened??  The following code (in adjust_abs_time()) is supposed to 
prevent this sort of thing:

	if (oc.tv_sec | oc.tv_nsec) {
		oc.tv_nsec += clock->res;
		timespec_norm(&oc);
	}

Also, we run rather extensive tests for this sort of thing.


-- 
George Anzinger   george@mvista.com
High-res-timers:  http://sourceforge.net/projects/high-res-timers/


  reply	other threads:[~2005-03-17  6:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-17  2:20 [PATCH 2.6] fix POSIX timers expire before their scheduled time Liu, Hong
2005-03-17  6:29 ` George Anzinger [this message]
2005-03-17  6:48   ` Hong Liu

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=423923D9.4050801@mvista.com \
    --to=george@mvista.com \
    --cc=hong.liu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /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