<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Sorry for sending my previous mail to wrong list. My co-worker told
me this <br>
list is the right place to be. <br>
<br>
Again, profuse thanks in advance!<br>
Shuxin<br>
<div class="moz-forward-container"><br>
<br>
-------- Original Message --------
<table class="moz-email-headers-table" border="0" cellpadding="0"
cellspacing="0">
<tbody>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject:
</th>
<td>Question about slab allocator</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date: </th>
<td>Wed, 07 May 2014 12:38:00 -0700</td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">From: </th>
<td>Shuxin Yang <a class="moz-txt-link-rfc2396E" href="mailto:shuxinyang.oss@gmail.com"><shuxinyang.oss@gmail.com></a></td>
</tr>
<tr>
<th align="RIGHT" nowrap="nowrap" valign="BASELINE">To: </th>
<td><a class="moz-txt-link-abbreviated" href="mailto:nginx@nginx.org">nginx@nginx.org</a> <a class="moz-txt-link-rfc2396E" href="mailto:nginx@nginx.org"><nginx@nginx.org></a></td>
</tr>
</tbody>
</table>
<br>
<br>
<pre>Hi,
I'm nginx newbie. I'm reading src/core/ngx_slab.c, and am confused
as to
the purpose of NGX_SLAB_PAGE_START.
As far as I can understand, when allocating a block, the most
significant
bit (MSB) of first page's corresponding ngx_slab_page_s::slab is set "1".
as we can see from :
cat -n <a class="moz-txt-link-abbreviated" href="mailto:ngx_slab.c@pristine-1.7-release">ngx_slab.c@pristine-1.7-release</a>
644 page->slab = pages | NGX_SLAB_PAGE_START;
However, the MSB of is cleared later on:
362 } else if (shift == ngx_slab_exact_shift) {
363
364 page->slab = 1;
So, what is the purpose of NGX_SLAB_PAGE_START (i.e the MSB of the
field slab)?
If we really meant to keep the MSB, I guess there is another bug over
here:
the condition at line 514 is always true, and hence we never get
chance to
free the empty page.
512 page->slab &= ~m;
513
514 if (page->slab) {
515 goto done;
516 }
517
518 ngx_slab_free_pages(pool, page, 1);
Thanks
Shuxin
</pre>
<br>
</div>
<br>
</body>
</html>