public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Olivier Daigle <odaigle@harfangmicro.com>
To: Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: __get_free_pages and page_count
Date: Tue, 18 Dec 2001 15:47:40 -0500	[thread overview]
Message-ID: <01121815474002.04766@hubble> (raw)

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

                 reply	other threads:[~2001-12-18 20:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01121815474002.04766@hubble \
    --to=odaigle@harfangmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox