]> git.kaiwu.me - nginx.git/commitdiff
Slab: fixed the number of pages calculation.
authorRuslan Ermilov <ru@nginx.com>
Wed, 7 Dec 2016 19:25:37 +0000 (22:25 +0300)
committerRuslan Ermilov <ru@nginx.com>
Wed, 7 Dec 2016 19:25:37 +0000 (22:25 +0300)
When estimating the number of pages, do not count memory for slots.
In some cases this gives one extra usable memory page.

src/core/ngx_slab.c

index 4357e8dd9a85e8dabad104ec3c2fbeacf205e8f2..b33f43f8ea3862b4113d3ce9991a0158bc3bf386 100644 (file)
@@ -120,6 +120,7 @@ ngx_slab_init(ngx_slab_pool_t *pool)
     }
 
     p += n * sizeof(ngx_slab_page_t);
+    size -= n * sizeof(ngx_slab_page_t);
 
     pages = (ngx_uint_t) (size / (ngx_pagesize + sizeof(ngx_slab_page_t)));