[nginx] Slab: fixed the number of pages calculation.

Ruslan Ermilov ru at nginx.com
Wed Dec 7 19:27:57 UTC 2016


details:   http://hg.nginx.org/nginx/rev/f6beb55792de
branches:  
changeset: 6825:f6beb55792de
user:      Ruslan Ermilov <ru at nginx.com>
date:      Wed Dec 07 22:25:37 2016 +0300
description:
Slab: fixed the number of pages calculation.

When estimating the number of pages, do not count memory for slots.
In some cases this gives one extra usable memory page.

diffstat:

 src/core/ngx_slab.c |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r ea12328518dc -r f6beb55792de src/core/ngx_slab.c
--- a/src/core/ngx_slab.c	Wed Dec 07 22:25:37 2016 +0300
+++ b/src/core/ngx_slab.c	Wed Dec 07 22:25:37 2016 +0300
@@ -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)));
 


More information about the nginx-devel mailing list