|
@@ -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
|
|
* The page might have been evicted from cache only
|
|
* recently, in which case it should be activated like
|
|
* recently, in which case it should be activated like
|
|
* any other repeatedly accessed page.
|
|
* 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);
|
|
SetPageActive(page);
|
|
workingset_activation(page);
|
|
workingset_activation(page);
|
|
} else
|
|
} else
|