Helge Hafting wrote:
We actually experimented with usleep(0) and select(...) with a zeroed timeval. Both of these approaches performed worse than just using sched_yield(), depending on the system and some other conditions. Dual-core AMD64 vs single-CPU had quite different behaviors. Also, if the slapd main event loop was using epoll() instead of select(), the select's used for yields slowed down by a couple orders of magnitude. (A test that normally took ~30 seconds took as long as 45 minutes in one case, it was quite erratic.)linux-os (Dick Johnson) wrote:To fix the current problem, you can substitute usleep(0); It will give the CPU to somebody if it's computable, then give it back to you. It seems to work in every case that sched_yield() has mucked up (perhaps 20 to 30 here).Isn't that dangerous? Someday, someone working on linux (or some other unixish os) might come up with an usleep implementation where usleep(0) just returns and becomes a no-op. Which probably is ok with the usleep spec - it did sleep for zero time . . .
It turned out that most of those yield's were leftovers inherited from when we only supported non-preemptive threads, and simply deleting them was the best approach.
-- -- Howard Chu Chief Architect, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc OpenLDAP Core Team http://www.openldap.org/project/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- From: Kyle Moffett <[email protected]>
- Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- References:
- e100 oops on resume
- From: Stefan Seyfried <[email protected]>
- Re: e100 oops on resume
- From: Mattia Dongili <[email protected]>
- Re: e100 oops on resume
- From: Olaf Kirch <[email protected]>
- Re: e100 oops on resume
- From: Olaf Kirch <[email protected]>
- Re: sched_yield() makes OpenLDAP slow
- From: Howard Chu <[email protected]>
- Re: sched_yield() makes OpenLDAP slow
- From: "Christopher Friesen" <[email protected]>
- pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- From: Howard Chu <[email protected]>
- Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- From: Lee Revell <[email protected]>
- Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- From: Howard Chu <[email protected]>
- Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- From: Nick Piggin <[email protected]>
- Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- From: Howard Chu <[email protected]>
- Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- From: Nick Piggin <[email protected]>
- Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- From: Howard Chu <[email protected]>
- Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- From: Nick Piggin <[email protected]>
- Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- From: Howard Chu <[email protected]>
- Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- From: "linux-os \(Dick Johnson\)" <[email protected]>
- Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- From: Helge Hafting <[email protected]>
- e100 oops on resume
- Prev by Date: Re: insmod error
- Next by Date: 2.6.15.1: kernel BUG at drivers/ide/ide-io.c:63!
- Previous by thread: Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- Next by thread: Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)
- Index(es):