Is this a bug?

Maxim Dounin mdounin at mdounin.ru
Sat Aug 18 23:18:36 UTC 2012


Hello!

On Sat, Aug 18, 2012 at 09:23:47AM -0400, lenky0401 wrote:

> 45:	    /*
> 46:	     * Preallocation of first nodes : 0, 1, 00, 01, 10, 11, 000, 001,
> etc.
> 47:	     * increases TLB hits even if for first lookup iterations.
> 48:	     * On 32-bit platforms the 7 preallocated bits takes continuous 4K,
> 49:	     * 8 - 8K, 9 - 16K, etc.  On 64-bit platforms the 6 preallocated
> bits
> 50:	     * takes continuous 4K, 7 - 8K, 8 - 16K, etc.  There is no sense to
> 51:	     * to preallocate more than one page, because further preallocation
> 52:	     * distributes the only bit per page.  Instead, a random insertion
> 53:	     * may distribute several bits per page.
> 54:	     *
> 55:	     * Thus, by default we preallocate maximum
> 56:	     *     6 bits on amd64 (64-bit platform and 4K pages)
> 57:	     *     7 bits on i386 (32-bit platform and 4K pages)
> 58:	     *     7 bits on sparc64 in 64-bit mode (8K pages)
> 59:	     *     8 bits on sparc64 in 32-bit mode (8K pages)
> 60:	     */
> 61:	
> 62:	    if (preallocate == -1) {
> 63:	        switch (ngx_pagesize / sizeof(ngx_radix_tree_t)) {              
> //ngx_radix_tree_t -> ngx_radix_node_t ?
> 
> Thanks in advance.

Sure.  Thanks for spotting this, fix committed:

http://trac.nginx.org/nginx/changeset/4824/nginx

Maxim Dounin



More information about the nginx mailing list