]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/linux/mm_inline.h
vmscan: second chance replacement for anonymous pages
[net-next-2.6.git] / include / linux / mm_inline.h
index 2eb599465d56a5f9dc14b95ccef489673f16ab0f..f451fedd1e75a2520e9eaef7a04dd693b009a7fc 100644 (file)
@@ -117,4 +117,23 @@ static inline enum lru_list page_lru(struct page *page)
        return lru;
 }
 
+/**
+ * inactive_anon_is_low - check if anonymous pages need to be deactivated
+ * @zone: zone to check
+ *
+ * Returns true if the zone does not have enough inactive anon pages,
+ * meaning some active anon pages need to be deactivated.
+ */
+static inline int inactive_anon_is_low(struct zone *zone)
+{
+       unsigned long active, inactive;
+
+       active = zone_page_state(zone, NR_ACTIVE_ANON);
+       inactive = zone_page_state(zone, NR_INACTIVE_ANON);
+
+       if (inactive * zone->inactive_ratio < active)
+               return 1;
+
+       return 0;
+}
 #endif