diff options
author | dm120769 <none@none> | 2007-04-27 07:12:39 -0700 |
---|---|---|
committer | dm120769 <none@none> | 2007-04-27 07:12:39 -0700 |
commit | 3348528f7ec68bf2f11d0cbd5c3b9932ea7f0d5c (patch) | |
tree | 855ea6b5ae3786966e656876cd1ac3992e072d51 /usr/src/uts/common/syscall/lwp_timer.c | |
parent | 85b65b39e9a6fea849facdcfc7d06f5ece340e36 (diff) | |
download | illumos-gate-3348528f7ec68bf2f11d0cbd5c3b9932ea7f0d5c.tar.gz |
backout 6265036/6531693: causes 6544953
Diffstat (limited to 'usr/src/uts/common/syscall/lwp_timer.c')
-rw-r--r-- | usr/src/uts/common/syscall/lwp_timer.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/usr/src/uts/common/syscall/lwp_timer.c b/usr/src/uts/common/syscall/lwp_timer.c index df5a3a6198..7c1d862bea 100644 --- a/usr/src/uts/common/syscall/lwp_timer.c +++ b/usr/src/uts/common/syscall/lwp_timer.c @@ -2,8 +2,9 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,7 +20,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -58,17 +59,16 @@ lwp_timer_timeout(void *arg) mutex_enter(&t->t_delay_lock); gethrestime(&now); - /* - * timeout is premature iff - * lwpt_lbolt >= lbolt and when > now + * Requeue the timeout if no one has reset the system time + * and if the absolute future time has not been reached. */ - if (lwptp->lwpt_lbolt >= lbolt && + if (lwptp->lwpt_timecheck == timechanged && (lwptp->lwpt_rqtime.tv_sec > now.tv_sec || (lwptp->lwpt_rqtime.tv_sec == now.tv_sec && lwptp->lwpt_rqtime.tv_nsec > now.tv_nsec))) { lwptp->lwpt_id = realtime_timeout(lwp_timer_timeout, lwptp, - timespectohz(&lwptp->lwpt_rqtime, now)); + timespectohz_adj(&lwptp->lwpt_rqtime, now)); } else { /* * Set the thread running only if it is asleep on @@ -93,6 +93,7 @@ lwp_timer_copyin(lwp_timer_t *lwptp, timespec_t *tsp) if (tsp == NULL) /* not really an error, just need to bzero() */ goto err; + lwptp->lwpt_timecheck = timechanged; /* do this before gethrestime() */ gethrestime(&now); /* do this before copyin() */ if (curproc->p_model == DATAMODEL_NATIVE) { if (copyin(tsp, &lwptp->lwpt_rqtime, sizeof (timespec_t))) { @@ -127,8 +128,6 @@ lwp_timer_copyin(lwp_timer_t *lwptp, timespec_t *tsp) lwptp->lwpt_id = 0; lwptp->lwpt_imm_timeout = 0; timespecadd(&lwptp->lwpt_rqtime, &now); - lwptp->lwpt_lbolt = lbolt + - timespectohz(&lwptp->lwpt_rqtime, now); } return (0); err: @@ -145,12 +144,7 @@ lwp_timer_enqueue(lwp_timer_t *lwptp) ASSERT(lwptp->lwpt_thread == curthread); ASSERT(MUTEX_HELD(&curthread->t_delay_lock)); gethrestime(&now); - - /* - * timeout is premature iff - * lwpt_lbolt >= lbolt and when > now - */ - if (lwptp->lwpt_lbolt >= lbolt && + if (lwptp->lwpt_timecheck == timechanged && (lwptp->lwpt_rqtime.tv_sec > now.tv_sec || (lwptp->lwpt_rqtime.tv_sec == now.tv_sec && lwptp->lwpt_rqtime.tv_nsec > now.tv_nsec))) { @@ -158,7 +152,7 @@ lwp_timer_enqueue(lwp_timer_t *lwptp) * Queue the timeout. */ lwptp->lwpt_id = realtime_timeout(lwp_timer_timeout, lwptp, - timespectohz(&lwptp->lwpt_rqtime, now)); + timespectohz_adj(&lwptp->lwpt_rqtime, now)); return (0); } |