Welcome! Log In Create A New Profile

Advanced

Fwd: Question about slab allocator

Shuxin Yang
May 07, 2014 03:44PM
Sorry for sending my previous mail to wrong list. My co-worker told me this
list is the right place to be.

Again, profuse thanks in advance!
Shuxin


-------- Original Message --------
Subject: Question about slab allocator
Date: Wed, 07 May 2014 12:38:00 -0700
From: Shuxin Yang <shuxinyang.oss@gmail.com>
To: nginx@nginx.org <nginx@nginx.org>



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 ngx_slab.c@pristine-1.7-release
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



_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Fwd: Question about slab allocator

Shuxin Yang 783 May 07, 2014 03:44PM

Re: Fwd: Question about slab allocator

Maxim Dounin 356 May 08, 2014 11:14PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 214
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready