aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/zcache/zcache-main.c4
-rw-r--r--include/linux/page-flags.h10
-rw-r--r--mm/vmscan.c4
3 files changed, 18 insertions, 0 deletions
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 61cce6b..eb65043 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -1748,6 +1748,8 @@ static void zcache_cleancache_put_page(int pool_id,
u32 ind = (u32) index;
struct tmem_oid oid = *(struct tmem_oid *)&key;
+ if (!PageWasActive(page))
+ return;
if (likely(ind == index))
(void)zcache_put_page(LOCAL_CLIENT, pool_id, &oid, index, page);
}
@@ -1762,6 +1764,8 @@ static int zcache_cleancache_get_page(int pool_id,
if (likely(ind == index))
ret = zcache_get_page(LOCAL_CLIENT, pool_id, &oid, index, page);
+ if (ret == 0)
+ SetPageWasActive(page);
return ret;
}
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 87a0009..657ba2c 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -51,6 +51,9 @@
* PG_hwpoison indicates that a page got corrupted in hardware and contains
* data with incorrect ECC bits that triggered a machine check. Accessing is
* not safe since it may cause another machine check. Don't touch!
+ *
+ * PG_wasactive reflects that a page previously was promoted to active status.
+ * Such pages should be considered higher priority for cleancache backends.
*/
/*
@@ -107,6 +110,9 @@ enum pageflags {
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
PG_compound_lock,
#endif
+#ifdef CONFIG_CLEANCACHE
+ PG_was_active,
+#endif
__NR_PAGEFLAGS,
/* Filesystems */
@@ -264,6 +270,10 @@ __PAGEFLAG(SlobFree, slob_free)
__PAGEFLAG(SlubFrozen, slub_frozen)
+#ifdef CONFIG_CLEANCACHE
+PAGEFLAG(WasActive, was_active)
+#endif
+
/*
* Private page markings that may be used by the filesystem that owns the page
* for its own purposes.
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 9b72c26..c11955c 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -624,6 +624,8 @@ void putback_lru_page(struct page *page)
int was_unevictable = PageUnevictable(page);
VM_BUG_ON(PageLRU(page));
+ if (active)
+ SetPageWasActive(page);
redo:
ClearPageUnevictable(page);
@@ -1289,6 +1291,7 @@ unsigned long clear_active_flags(struct list_head *page_list,
if (PageActive(page)) {
lru += LRU_ACTIVE;
ClearPageActive(page);
+ SetPageWasActive(page);
nr_active += numpages;
}
if (count)
@@ -1710,6 +1713,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
}
ClearPageActive(page); /* we are de-activating */
+ SetPageWasActive(page);
list_add(&page->lru, &l_inactive);
}