[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: (ITS#3950) sched_yield() considered harmful
Bernardo Innocenti wrote:
> Howard Chu wrote:
>
>> Please try the OpenLDAP 2.3 release; I don't believe any performance
>> issue exists here.
>>
>
> Sorry, I've just upgraded to 2.3.11 and the problem is still there.
> (see the audit trail of #3950 for more information).
>
> Is there a way to build slapd without threading?
There was, but I suspect a lot of the code in 2.3 will break without it now.
> Or using a backend
> that doesn't require sched_yield()? This issue is killing a critical
> server of mine.
>
Try this patch for libldap_r/thr_posix.c; recompile libldap_r and relink
slapd...
RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldap_r/thr_posix.c,v
retrieving revision 1.40
diff -u -r1.40 thr_posix.c
--- thr_posix.c 17 Sep 2005 21:28:08 -0000 1.40
+++ thr_posix.c 25 Nov 2005 20:07:23 -0000
@@ -20,6 +20,11 @@
#include <ac/errno.h>
+#if defined( HAVE_YIELDING_SELECT )
+#include <ac/socket.h>
+#include <ac/time.h>
+#endif
+
#include "ldap_pvt_thread.h" /* Get the thread interface */
#define LDAP_THREAD_IMPLEMENTATION
#define LDAP_THREAD_RDWR_IMPLEMENTATION
@@ -207,7 +212,11 @@
int
ldap_pvt_thread_yield( void )
{
-#if HAVE_THR_YIELD
+#if HAVE_YIELDING_SELECT
+ struct timeval tv = {0,0};
+ select( 0, NULL, NULL, NULL, &tv );
+ return 0;
+#elif HAVE_THR_YIELD
return thr_yield();
#elif HAVE_PTHREADS == 10
--
-- 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/