[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: _count and page_count



On Sat, 2006-11-04 at 23:09 -0700, arun s wrote:
> hi kernel ,
> is there any problem or difference  in checking the _count field in
> page and using the page_count()  function for checking page status .

Here is the code for checking _count:
x = page->_count;

And here is the code for page_count():
if (PageCompound(page))
	page = (struct page *)page_private(page);
return atomic_read(&page->_count) + 1;

So page_count():
1. Handles compound pages
2. Reads atomically
3. Adds 1 to get the proper value

Avishay Traeger
http://www.fsl.cs.sunysb.edu/~avishay/


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/