__get_free_pages and page_count

Olivier Daigle (odaigle@harfangmicro.com)
Tue, 18 Dec 2001 15:47:40 -0500


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,
Simple question regarding __get_free_pages and (struct page*)->count. Why
does only the first page returned by __get_free_pages have it's count set to
1 and all other pages have their count set to 0?

Example:

#define ORDER 2

unsigned long p, offset=0;
struct page *page;

if(!(p=__get_free_pages(SLAB_KERNEL, ORDER))) {
goto err;
}

while(offset < PAGE_SIZE<<ORDER) {
page=virt_to_page(p+offset);
SC_DEBUG(" offset: %lu, page_count is %d", offset, page_count(page));
offset+=PAGE_SIZE;
}

Resulting output is:
Dec 18 15:36:14 meteor kernel: sc: offset: 0, page_count is 1
Dec 18 15:36:14 meteor kernel: sc: offset: 4096, page_count is 0
Dec 18 15:36:14 meteor kernel: sc: offset: 8192, page_count is 0
Dec 18 15:36:14 meteor kernel: sc: offset: 12288, page_count is 0

Thanks,

Olivier

- --
Olivier Daigle <odaigle@harfangmicro.com>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.5 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8H6tsOVJ6DEeRbpERAgTLAKCV6nBuOKKskB8mdhBSwIzoyPGR0gCgh0JN
apjYQFpFixJMiDmn8JrmkXg=
=koo5
-----END PGP SIGNATURE-----
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/