public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* __get_free_pages and page_count
@ 2001-12-18 20:47 Olivier Daigle
  0 siblings, 0 replies; only message in thread
From: Olivier Daigle @ 2001-12-18 20:47 UTC (permalink / raw)
  To: Kernel Mailing List

-----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-----

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-12-18 20:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-18 20:47 __get_free_pages and page_count Olivier Daigle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox