]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - mm/filemap.c
mm, compaction: distinguish COMPACT_DEFERRED from COMPACT_SKIPPED
[karo-tx-linux.git] / mm / filemap.c
index 01690338e3d283a1de55772219ea1703e125a34d..8f4859989f1b7363953b86f86696fde93d1cddbd 100644 (file)
@@ -713,8 +713,12 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
                 * The page might have been evicted from cache only
                 * recently, in which case it should be activated like
                 * any other repeatedly accessed page.
+                * The exception is pages getting rewritten; evicting other
+                * data from the working set, only to cache data that will
+                * get overwritten with something else, is a waste of memory.
                 */
-               if (shadow && workingset_refault(shadow)) {
+               if (!(gfp_mask & __GFP_WRITE) &&
+                   shadow && workingset_refault(shadow)) {
                        SetPageActive(page);
                        workingset_activation(page);
                } else
@@ -2574,7 +2578,7 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping,
                                        pgoff_t index, unsigned flags)
 {
        struct page *page;
-       int fgp_flags = FGP_LOCK|FGP_ACCESSED|FGP_WRITE|FGP_CREAT;
+       int fgp_flags = FGP_LOCK|FGP_WRITE|FGP_CREAT;
 
        if (flags & AOP_FLAG_NOFS)
                fgp_flags |= FGP_NOFS;