Author: hselasky Date: Fri Aug 30 10:39:56 2013 New Revision: 255067 URL: http://svnweb.freebsd.org/changeset/base/255067
Log: Simplify pause_sbt() logic. Don't call DELAY() if remainder is less than or equal to zero. Modified: head/sys/kern/kern_synch.c Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Fri Aug 30 10:10:22 2013 (r255066) +++ head/sys/kern/kern_synch.c Fri Aug 30 10:39:56 2013 (r255067) @@ -356,10 +356,7 @@ msleep_spin_sbt(void *ident, struct mtx int pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) { - int sbt_sec; - - sbt_sec = sbintime_getsec(sbt); - KASSERT(sbt_sec >= 0, ("pause: timo must be >= 0")); + KASSERT(sbt >= 0, ("pause: timeout must be >= 0")); /* silently convert invalid timeouts */ if (sbt == 0) @@ -370,11 +367,14 @@ pause_sbt(const char *wmesg, sbintime_t * We delay one second at a time to avoid overflowing the * system specific DELAY() function(s): */ - while (sbt_sec > 0) { + while (sbt >= SBT_1S) { DELAY(1000000); - sbt_sec--; + sbt -= SBT_1S; } - DELAY((sbt & 0xffffffff) / SBT_1US); + /* Do the delay remainder, if any */ + sbt = (sbt + SBT_1US - 1) / SBT_1US; + if (sbt > 0) + DELAY(sbt); return (0); } return (_sleep(&pause_wchan[curcpu], NULL, 0, wmesg, sbt, pr, flags)); _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"