[nginx] Slab: added comment about list heads.

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


details:   http://hg.nginx.org/nginx/rev/ea12328518dc
branches:  
changeset: 6824:ea12328518dc
user:      Ruslan Ermilov <ru at nginx.com>
date:      Wed Dec 07 22:25:37 2016 +0300
description:
Slab: added comment about list heads.

diffstat:

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

diffs (23 lines):

diff -r 88c8c3d65184 -r ea12328518dc 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
@@ -113,6 +113,7 @@ ngx_slab_init(ngx_slab_pool_t *pool)
     n = ngx_pagesize_shift - pool->min_shift;
 
     for (i = 0; i < n; i++) {
+        /* only "next" is used in list head */
         slots[i].slab = 0;
         slots[i].next = &slots[i];
         slots[i].prev = 0;
@@ -127,8 +128,10 @@ ngx_slab_init(ngx_slab_pool_t *pool)
 
     page = pool->pages;
 
+    /* only "next" is used in list head */
+    pool->free.slab = 0;
+    pool->free.next = page;
     pool->free.prev = 0;
-    pool->free.next = page;
 
     page->slab = pages;
     page->next = &pool->free;


More information about the nginx-devel mailing list