]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] hot-n-cold pages: use cold pages for readahead
authorAndrew Morton <akpm@digeo.com>
Wed, 30 Oct 2002 07:36:03 +0000 (23:36 -0800)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Wed, 30 Oct 2002 07:36:03 +0000 (23:36 -0800)
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.

include/linux/pagemap.h
mm/filemap.c
mm/readahead.c

index 1fe640eaf601f6816b08808da887d581957cb732..d2e647ac9623bada1821f6d7d0a42a08246c1eb7 100644 (file)
@@ -31,6 +31,11 @@ static inline struct page *page_cache_alloc(struct address_space *x)
        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,
index 5cc2c080c33148915c3c80ed1696cedc6360446d..af26d617f922607a6a0e257e02d4dc9f7ee2453a 100644 (file)
@@ -258,7 +258,7 @@ static int page_cache_read(struct file * file, unsigned long offset)
        struct page *page; 
        int error;
 
-       page = page_cache_alloc(mapping);
+       page = page_cache_alloc_cold(mapping);
        if (!page)
                return -ENOMEM;
 
@@ -705,7 +705,7 @@ no_cached_page:
                 * page..
                 */
                if (!cached_page) {
-                       cached_page = page_cache_alloc(mapping);
+                       cached_page = page_cache_alloc_cold(mapping);
                        if (!cached_page) {
                                desc->error = -ENOMEM;
                                break;
@@ -1199,7 +1199,7 @@ repeat:
        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);
                }
index 0ab09031edebdd972f3ce646773208725e12582e..6174f412e6e89c675f2b8edcb97d6221ef7952d1 100644 (file)
@@ -176,7 +176,7 @@ int do_page_cache_readahead(struct address_space *mapping,
                        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;