Is this a bug?

lenky0401 nginx-forum at nginx.us
Sat Aug 18 13:23:47 UTC 2012


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.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,229884,229884#msg-229884



More information about the nginx mailing list