The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Michael Arras <mkarras110@yahoo.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Fix for sys_nanosleep() in 2.4.16
Date: Thu, 29 Nov 2001 01:56:29 -0500	[thread overview]
Message-ID: <3C05DC1D.7071FC6B@yahoo.com> (raw)

Greetings,

For many of us, the kernel thread scheduling resolution is
10ms (see getitimer(2)).  By adding 1 jiffy to the time to
sleep in sys_nanosleep(), threads are sleeping 10ms too long.
timespec_to_jiffies() does a good job at returning the
appropriate number of jiffies to sleep.  There is no need to
add one for good measure.

Mike Arras
mkarras110@yahoo.com

diff -urN linux-2.4.16/kernel/timer.c linux/kernel/timer.c
--- linux-2.4.16/kernel/timer.c Mon Oct  8 13:41:41 2001
+++ linux/kernel/timer.c        Wed Nov 28 00:23:15 2001
@@ -825,7 +825,7 @@
                return 0;
        }
 
-       expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec);
+       expire = timespec_to_jiffies(&t);
 
        current->state = TASK_INTERRUPTIBLE;
        expire = schedule_timeout(expire);

             reply	other threads:[~2001-11-29  6:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-29  6:56 Michael Arras [this message]
2001-11-29 10:04 ` [PATCH] Fix for sys_nanosleep() in 2.4.16 Christoph Hellwig
2001-11-29 23:41 ` george anzinger

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=3C05DC1D.7071FC6B@yahoo.com \
    --to=mkarras110@yahoo.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