It is usually the case that pagecache reads use busmastering hardware
to transfer the data into pagecache. This invalidates the CPU cache of
the pagecache pages.
So use cache-cold pages for pagecache reads. To avoid wasting
cache-hot pages.
return alloc_pages(x->gfp_mask, 0);
}
+static inline struct page *page_cache_alloc_cold(struct address_space *x)
+{
+ return alloc_pages(x->gfp_mask|__GFP_COLD, 0);
+}
+
typedef int filler_t(void *, struct page *);
extern struct page * find_get_page(struct address_space *mapping,
struct page *page;
int error;
- page = page_cache_alloc(mapping);
+ page = page_cache_alloc_cold(mapping);
if (!page)
return -ENOMEM;
* page..
*/
if (!cached_page) {
- cached_page = page_cache_alloc(mapping);
+ cached_page = page_cache_alloc_cold(mapping);
if (!cached_page) {
desc->error = -ENOMEM;
break;
page = find_get_page(mapping, index);
if (!page) {
if (!cached_page) {
- cached_page = page_cache_alloc(mapping);
+ cached_page = page_cache_alloc_cold(mapping);
if (!cached_page)
return ERR_PTR(-ENOMEM);
}
continue;
read_unlock(&mapping->page_lock);
- page = page_cache_alloc(mapping);
+ page = page_cache_alloc_cold(mapping);
read_lock(&mapping->page_lock);
if (!page)
break;