* Can we put the pages allocated by alloc_pages in the page cache?
@ 2011-09-05 3:05 Da Zheng
0 siblings, 0 replies; only message in thread
From: Da Zheng @ 2011-09-05 3:05 UTC (permalink / raw)
To: kernelnewbies
Hello,
I'm modifying a filesystem. I need to allocate multiple contiguous pages to
store data, and I use alloc_pages to do so. In order to reduce memory copy, I
should put these pages directly to the page cache. I don't know if it's proper.
Can I allocate multiple pages together and free them and return them to the
buddy system separately? VFS uses page_cache_alloc to allocate a page each time,
so the pages can be freed independently.
My other concern is the reference counters of the pages. When I allocate
multiple contiguous pages with alloc_pages, only the first page's counter is 1.
The reference counters of the remaining pages are 0. It confuses me. Should I
set the reference counters of all pages to 1 first before I add them in the page
cache? Understanding the Linux Kernel says a page is unused when its reference
counter is -1, instead of 0. I wonder who is using the page when its counter is 0.
Thanks,
Da
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-09-05 3:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-05 3:05 Can we put the pages allocated by alloc_pages in the page cache? Da Zheng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.