Can we put the pages allocated by alloc_pages in the page cache?

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

 



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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux