From: Howard Chu Date: Wed, 3 Jan 2007 02:06:06 +0000 (+0000) Subject: Tweak entry alignment, play with STRIPE/STRIDE definitions to test. X-Git-Tag: OPENLDAP_REL_ENG_2_4_4ALPHA~8^2~275 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2c1f91dd0ff250133fcf1fafa89b07e1cca9fe91;p=openldap Tweak entry alignment, play with STRIPE/STRIDE definitions to test. --- diff --git a/servers/slapd/entry.c b/servers/slapd/entry.c index a5314f3070..220d7a22f5 100644 --- a/servers/slapd/entry.c +++ b/servers/slapd/entry.c @@ -444,22 +444,30 @@ entry_clean( Entry *e ) /* e_private must be freed by the caller */ assert( e->e_private == NULL ); + e->e_id = 0; + /* free DNs */ if ( !BER_BVISNULL( &e->e_name ) ) { free( e->e_name.bv_val ); + BER_BVZERO( &e->e_name ); } if ( !BER_BVISNULL( &e->e_nname ) ) { free( e->e_nname.bv_val ); + BER_BVZERO( &e->e_nname ); } if ( !BER_BVISNULL( &e->e_bv ) ) { free( e->e_bv.bv_val ); + BER_BVZERO( &e->e_bv ); } /* free attributes */ - attrs_free( e->e_attrs ); + if ( e->e_attrs ) { + attrs_free( e->e_attrs ); + e->e_attrs = NULL; + } - memset(e, 0, sizeof(Entry)); + e->e_ocflags = 0; } void @@ -473,24 +481,45 @@ entry_free( Entry *e ) ldap_pvt_thread_mutex_unlock( &entry_mutex ); } +/* These parameters work well on AMD64 */ +#if 0 +#define STRIDE 8 +#define STRIPE 5 +#else +#define STRIDE 1 +#define STRIPE 1 +#endif +#define STRIDE_FACTOR (STRIDE*STRIPE) + int entry_prealloc( int num ) { - Entry *e; + Entry *e, **prev, *tmp; slap_list *s; + int i, j; if (!num) return 0; + /* Round up to our stride factor */ + num += STRIDE_FACTOR-1; + num /= STRIDE_FACTOR; + num *= STRIDE_FACTOR; + s = ch_calloc( 1, sizeof(slap_list) + num * sizeof(Entry)); s->next = entry_chunks; entry_chunks = s; - e = (Entry *)(s+1); - for ( ;num>1; num--) { - e->e_private = e+1; - e++; + prev = &tmp; + for (i=0; ie_private; + e += STRIDE; + } } - e->e_private = entry_list; + *prev = entry_list; entry_list = (Entry *)(s+1); return 0;