[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080317193415.GA12234@c2.user-mode-linux.org>
Date: Mon, 17 Mar 2008 15:34:15 -0400
From: Jeff Dike <jdike@...toit.com>
To: Nix <nix@...eri.org.uk>
Cc: clowncoder <vincent-perrier@...b-internet.fr>,
user-mode-linux-devel@...ts.sourceforge.net,
linux-kernel Mailing List <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...esys.com>
Subject: Re: [2.6.24.x] UML select()/poll() oversleeping reproducibly (was
Re: [uml-devel] g_timeout_add)
Below is the same patch with another kluge, which cuts down the
requested sleep by 10% in hopes of getting the actual sleep closer to
what's wanted.
This is unusable in anything resembling mainline, but I'd like to see
how your various systems react to it. I'm getting very close to the
sleeps I asked for (with slight undersleeping, which is a bug).
Jeff
--
Work email - jdike at linux dot intel dot com
Index: linux-2.6.22/arch/um/os-Linux/time.c
===================================================================
--- linux-2.6.22.orig/arch/um/os-Linux/time.c 2008-02-18 11:53:51.000000000 -0500
+++ linux-2.6.22/arch/um/os-Linux/time.c 2008-03-17 15:11:51.000000000 -0400
@@ -58,12 +58,17 @@ static inline long long timeval_to_ns(co
long long disable_timer(void)
{
struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } });
+ int remain, max = UM_NSEC_PER_SEC / UM_HZ;
if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0)
printk(UM_KERN_ERR "disable_timer - setitimer failed, "
"errno = %d\n", errno);
- return timeval_to_ns(&time.it_value);
+ remain = timeval_to_ns(&time.it_value);
+ if (remain > max)
+ remain = max;
+
+ return remain;
}
long long os_nsecs(void)
@@ -126,6 +131,8 @@ void idle_sleep(unsigned long long nsecs
*/
if (nsecs == 0)
nsecs = UM_NSEC_PER_SEC / UM_HZ;
+
+ nsecs = nsecs * 9 / 10;
ts = ((struct timespec) { .tv_sec = nsecs / UM_NSEC_PER_SEC,
.tv_nsec = nsecs % UM_NSEC_PER_SEC });
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists