All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <20160212202405.GA32367@cmpxchg.org>

diff --git a/a/1.txt b/N1/1.txt
index 84115df..65f83ff 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -30,3 +30,299 @@ On Thu, Feb 11, 2016 at 03:34:04PM -0500, Rik van Riel wrote:
 Yes, the anon ratio we use looks like a good fit for file as well.
 
 I've updated the patch to work with cgroups.
+
+>From 4d8ab2e69e16b7b59551e796283c046149698e9b Mon Sep 17 00:00:00 2001
+From: Rik van Riel <riel@redhat.com>
+Date: Fri, 12 Feb 2016 15:15:26 -0500
+Subject: [PATCH] mm,vmscan: reduce size of inactive file list
+
+The inactive file list should still be large enough to contain
+readahead windows and freshly written file data, but it no
+longer is the only source for detecting multiple accesses to
+file pages. The workingset refault measurement code causes
+recently evicted file pages that get accessed again after a
+shorter interval to be promoted directly to the active list.
+
+With that mechanism in place, we can afford to (on a larger
+system) dedicate more memory to the active file list, so we
+can actually cache more of the frequently used file pages
+in memory, and not have them pushed out by streaming writes,
+once-used streaming file reads, etc.
+
+This can help things like database workloads, where only
+half the page cache can currently be used to cache the
+database working set. This patch automatically increases
+that fraction on larger systems, using the same ratio that
+has already been used for anonymous memory.
+
+[hannes@cmpxchg.org: cgroup-awareness]
+Signed-off-by: Rik van Riel <riel@redhat.com>
+Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
+Reported-by: Andres Freund <andres@anarazel.de>
+---
+ include/linux/memcontrol.h |  25 -----------
+ mm/page_alloc.c            |  44 -------------------
+ mm/vmscan.c                | 104 ++++++++++++++++++---------------------------
+ 3 files changed, 42 insertions(+), 131 deletions(-)
+
+diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
+index 1191d79..3694f88 100644
+--- a/include/linux/memcontrol.h
++++ b/include/linux/memcontrol.h
+@@ -415,25 +415,6 @@ unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru)
+ 	return mz->lru_size[lru];
+ }
+ 
+-static inline bool mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec)
+-{
+-	unsigned long inactive_ratio;
+-	unsigned long inactive;
+-	unsigned long active;
+-	unsigned long gb;
+-
+-	inactive = mem_cgroup_get_lru_size(lruvec, LRU_INACTIVE_ANON);
+-	active = mem_cgroup_get_lru_size(lruvec, LRU_ACTIVE_ANON);
+-
+-	gb = (inactive + active) >> (30 - PAGE_SHIFT);
+-	if (gb)
+-		inactive_ratio = int_sqrt(10 * gb);
+-	else
+-		inactive_ratio = 1;
+-
+-	return inactive * inactive_ratio < active;
+-}
+-
+ void mem_cgroup_handle_over_high(void);
+ 
+ void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
+@@ -646,12 +627,6 @@ static inline bool mem_cgroup_online(struct mem_cgroup *memcg)
+ 	return true;
+ }
+ 
+-static inline bool
+-mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec)
+-{
+-	return true;
+-}
+-
+ static inline unsigned long
+ mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru)
+ {
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c
+index c849a20..9269736e 100644
+--- a/mm/page_alloc.c
++++ b/mm/page_alloc.c
+@@ -6439,49 +6439,6 @@ void setup_per_zone_wmarks(void)
+ }
+ 
+ /*
+- * The inactive anon list should be small enough that the VM never has to
+- * do too much work, but large enough that each inactive page has a chance
+- * to be referenced again before it is swapped out.
+- *
+- * The inactive_anon ratio is the target ratio of ACTIVE_ANON to
+- * INACTIVE_ANON pages on this zone's LRU, maintained by the
+- * pageout code. A zone->inactive_ratio of 3 means 3:1 or 25% of
+- * the anonymous pages are kept on the inactive list.
+- *
+- * total     target    max
+- * memory    ratio     inactive anon
+- * -------------------------------------
+- *   10MB       1         5MB
+- *  100MB       1        50MB
+- *    1GB       3       250MB
+- *   10GB      10       0.9GB
+- *  100GB      31         3GB
+- *    1TB     101        10GB
+- *   10TB     320        32GB
+- */
+-static void __meminit calculate_zone_inactive_ratio(struct zone *zone)
+-{
+-	unsigned int gb, ratio;
+-
+-	/* Zone size in gigabytes */
+-	gb = zone->managed_pages >> (30 - PAGE_SHIFT);
+-	if (gb)
+-		ratio = int_sqrt(10 * gb);
+-	else
+-		ratio = 1;
+-
+-	zone->inactive_ratio = ratio;
+-}
+-
+-static void __meminit setup_per_zone_inactive_ratio(void)
+-{
+-	struct zone *zone;
+-
+-	for_each_zone(zone)
+-		calculate_zone_inactive_ratio(zone);
+-}
+-
+-/*
+  * Initialise min_free_kbytes.
+  *
+  * For small machines we want it small (128k min).  For large machines
+@@ -6526,7 +6483,6 @@ int __meminit init_per_zone_wmark_min(void)
+ 	setup_per_zone_wmarks();
+ 	refresh_zone_stat_thresholds();
+ 	setup_per_zone_lowmem_reserve();
+-	setup_per_zone_inactive_ratio();
+ 	return 0;
+ }
+ module_init(init_per_zone_wmark_min)
+diff --git a/mm/vmscan.c b/mm/vmscan.c
+index 86eb214..1585579 100644
+--- a/mm/vmscan.c
++++ b/mm/vmscan.c
+@@ -1865,83 +1865,63 @@ static void shrink_active_list(unsigned long nr_to_scan,
+ 	free_hot_cold_page_list(&l_hold, true);
+ }
+ 
+-#ifdef CONFIG_SWAP
+-static bool inactive_anon_is_low_global(struct zone *zone)
+-{
+-	unsigned long active, inactive;
+-
+-	active = zone_page_state(zone, NR_ACTIVE_ANON);
+-	inactive = zone_page_state(zone, NR_INACTIVE_ANON);
+-
+-	return inactive * zone->inactive_ratio < active;
+-}
+-
+-/**
+- * inactive_anon_is_low - check if anonymous pages need to be deactivated
+- * @lruvec: LRU vector to check
++/*
++ * The inactive anon list should be small enough that the VM never has
++ * to do too much work.
+  *
+- * Returns true if the zone does not have enough inactive anon pages,
+- * meaning some active anon pages need to be deactivated.
+- */
+-static bool inactive_anon_is_low(struct lruvec *lruvec)
+-{
+-	/*
+-	 * If we don't have swap space, anonymous page deactivation
+-	 * is pointless.
+-	 */
+-	if (!total_swap_pages)
+-		return false;
+-
+-	if (!mem_cgroup_disabled())
+-		return mem_cgroup_inactive_anon_is_low(lruvec);
+-
+-	return inactive_anon_is_low_global(lruvec_zone(lruvec));
+-}
+-#else
+-static inline bool inactive_anon_is_low(struct lruvec *lruvec)
+-{
+-	return false;
+-}
+-#endif
+-
+-/**
+- * inactive_file_is_low - check if file pages need to be deactivated
+- * @lruvec: LRU vector to check
++ * The inactive file list should be small enough to leave most memory
++ * to the established workingset on the scan-resistant active list,
++ * but large enough to avoid thrashing the aggregate readahead window.
+  *
+- * When the system is doing streaming IO, memory pressure here
+- * ensures that active file pages get deactivated, until more
+- * than half of the file pages are on the inactive list.
++ * Both inactive lists should also be large enough that each inactive
++ * page has a chance to be referenced again before it is reclaimed.
+  *
+- * Once we get to that situation, protect the system's working
+- * set from being evicted by disabling active file page aging.
++ * The inactive_ratio is the target ratio of ACTIVE to INACTIVE pages
++ * on this LRU, maintained by the pageout code. A zone->inactive_ratio
++ * of 3 means 3:1 or 25% of the pages are kept on the inactive list.
+  *
+- * This uses a different ratio than the anonymous pages, because
+- * the page cache uses a use-once replacement algorithm.
++ * total     target    max
++ * memory    ratio     inactive
++ * -------------------------------------
++ *   10MB       1         5MB
++ *  100MB       1        50MB
++ *    1GB       3       250MB
++ *   10GB      10       0.9GB
++ *  100GB      31         3GB
++ *    1TB     101        10GB
++ *   10TB     320        32GB
+  */
+-static bool inactive_file_is_low(struct lruvec *lruvec)
++static bool inactive_list_is_low(struct lruvec *lruvec, bool file)
+ {
++	unsigned long inactive_ratio;
+ 	unsigned long inactive;
+ 	unsigned long active;
++	unsigned long gb;
+ 
+-	inactive = lruvec_lru_size(lruvec, LRU_INACTIVE_FILE);
+-	active = lruvec_lru_size(lruvec, LRU_ACTIVE_FILE);
++	/*
++	 * If we don't have swap space, anonymous page deactivation
++	 * is pointless.
++	 */
++	if (!file && !total_swap_pages)
++		return false;
+ 
+-	return active > inactive;
+-}
++	inactive = lruvec_lru_size(lruvec, file * LRU_FILE);
++	active = lruvec_lru_size(lruvec, file * LRU_FILE + LRU_ACTIVE);
+ 
+-static bool inactive_list_is_low(struct lruvec *lruvec, enum lru_list lru)
+-{
+-	if (is_file_lru(lru))
+-		return inactive_file_is_low(lruvec);
++	gb = (inactive + active) >> (30 - PAGE_SHIFT);
++	if (gb)
++		inactive_ratio = int_sqrt(10 * gb);
+ 	else
+-		return inactive_anon_is_low(lruvec);
++		inactive_ratio = 1;
++
++	return inactive * inactive_ratio < active;
+ }
+ 
+ static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
+ 				 struct lruvec *lruvec, struct scan_control *sc)
+ {
+ 	if (is_active_lru(lru)) {
+-		if (inactive_list_is_low(lruvec, lru))
++		if (inactive_list_is_low(lruvec, is_file_lru(lru)))
+ 			shrink_active_list(nr_to_scan, lruvec, sc, lru);
+ 		return 0;
+ 	}
+@@ -2062,7 +2042,7 @@ static void get_scan_count(struct lruvec *lruvec, struct mem_cgroup *memcg,
+ 	 * lruvec even if it has plenty of old anonymous pages unless the
+ 	 * system is under heavy pressure.
+ 	 */
+-	if (!inactive_file_is_low(lruvec) &&
++	if (!inactive_list_is_low(lruvec, true) &&
+ 	    lruvec_lru_size(lruvec, LRU_INACTIVE_FILE) >> sc->priority) {
+ 		scan_balance = SCAN_FILE;
+ 		goto out;
+@@ -2304,7 +2284,7 @@ static void shrink_zone_memcg(struct zone *zone, struct mem_cgroup *memcg,
+ 	 * Even if we did not try to evict anon pages at all, we want to
+ 	 * rebalance the anon lru active/inactive ratio.
+ 	 */
+-	if (inactive_anon_is_low(lruvec))
++	if (inactive_list_is_low(lruvec, false))
+ 		shrink_active_list(SWAP_CLUSTER_MAX, lruvec,
+ 				   sc, LRU_ACTIVE_ANON);
+ 
+@@ -2948,7 +2928,7 @@ static void age_active_anon(struct zone *zone, struct scan_control *sc)
+ 	do {
+ 		struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg);
+ 
+-		if (inactive_anon_is_low(lruvec))
++		if (inactive_list_is_low(lruvec, false))
+ 			shrink_active_list(SWAP_CLUSTER_MAX, lruvec,
+ 					   sc, LRU_ACTIVE_ANON);
+ 
+-- 
+2.7.0
diff --git a/a/content_digest b/N1/content_digest
index 202a5f1..aee389e 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -42,6 +42,302 @@
  "\n"
  "Yes, the anon ratio we use looks like a good fit for file as well.\n"
  "\n"
- I've updated the patch to work with cgroups.
+ "I've updated the patch to work with cgroups.\n"
+ "\n"
+ ">From 4d8ab2e69e16b7b59551e796283c046149698e9b Mon Sep 17 00:00:00 2001\n"
+ "From: Rik van Riel <riel@redhat.com>\n"
+ "Date: Fri, 12 Feb 2016 15:15:26 -0500\n"
+ "Subject: [PATCH] mm,vmscan: reduce size of inactive file list\n"
+ "\n"
+ "The inactive file list should still be large enough to contain\n"
+ "readahead windows and freshly written file data, but it no\n"
+ "longer is the only source for detecting multiple accesses to\n"
+ "file pages. The workingset refault measurement code causes\n"
+ "recently evicted file pages that get accessed again after a\n"
+ "shorter interval to be promoted directly to the active list.\n"
+ "\n"
+ "With that mechanism in place, we can afford to (on a larger\n"
+ "system) dedicate more memory to the active file list, so we\n"
+ "can actually cache more of the frequently used file pages\n"
+ "in memory, and not have them pushed out by streaming writes,\n"
+ "once-used streaming file reads, etc.\n"
+ "\n"
+ "This can help things like database workloads, where only\n"
+ "half the page cache can currently be used to cache the\n"
+ "database working set. This patch automatically increases\n"
+ "that fraction on larger systems, using the same ratio that\n"
+ "has already been used for anonymous memory.\n"
+ "\n"
+ "[hannes@cmpxchg.org: cgroup-awareness]\n"
+ "Signed-off-by: Rik van Riel <riel@redhat.com>\n"
+ "Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>\n"
+ "Reported-by: Andres Freund <andres@anarazel.de>\n"
+ "---\n"
+ " include/linux/memcontrol.h |  25 -----------\n"
+ " mm/page_alloc.c            |  44 -------------------\n"
+ " mm/vmscan.c                | 104 ++++++++++++++++++---------------------------\n"
+ " 3 files changed, 42 insertions(+), 131 deletions(-)\n"
+ "\n"
+ "diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h\n"
+ "index 1191d79..3694f88 100644\n"
+ "--- a/include/linux/memcontrol.h\n"
+ "+++ b/include/linux/memcontrol.h\n"
+ "@@ -415,25 +415,6 @@ unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru)\n"
+ " \treturn mz->lru_size[lru];\n"
+ " }\n"
+ " \n"
+ "-static inline bool mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec)\n"
+ "-{\n"
+ "-\tunsigned long inactive_ratio;\n"
+ "-\tunsigned long inactive;\n"
+ "-\tunsigned long active;\n"
+ "-\tunsigned long gb;\n"
+ "-\n"
+ "-\tinactive = mem_cgroup_get_lru_size(lruvec, LRU_INACTIVE_ANON);\n"
+ "-\tactive = mem_cgroup_get_lru_size(lruvec, LRU_ACTIVE_ANON);\n"
+ "-\n"
+ "-\tgb = (inactive + active) >> (30 - PAGE_SHIFT);\n"
+ "-\tif (gb)\n"
+ "-\t\tinactive_ratio = int_sqrt(10 * gb);\n"
+ "-\telse\n"
+ "-\t\tinactive_ratio = 1;\n"
+ "-\n"
+ "-\treturn inactive * inactive_ratio < active;\n"
+ "-}\n"
+ "-\n"
+ " void mem_cgroup_handle_over_high(void);\n"
+ " \n"
+ " void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,\n"
+ "@@ -646,12 +627,6 @@ static inline bool mem_cgroup_online(struct mem_cgroup *memcg)\n"
+ " \treturn true;\n"
+ " }\n"
+ " \n"
+ "-static inline bool\n"
+ "-mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec)\n"
+ "-{\n"
+ "-\treturn true;\n"
+ "-}\n"
+ "-\n"
+ " static inline unsigned long\n"
+ " mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru)\n"
+ " {\n"
+ "diff --git a/mm/page_alloc.c b/mm/page_alloc.c\n"
+ "index c849a20..9269736e 100644\n"
+ "--- a/mm/page_alloc.c\n"
+ "+++ b/mm/page_alloc.c\n"
+ "@@ -6439,49 +6439,6 @@ void setup_per_zone_wmarks(void)\n"
+ " }\n"
+ " \n"
+ " /*\n"
+ "- * The inactive anon list should be small enough that the VM never has to\n"
+ "- * do too much work, but large enough that each inactive page has a chance\n"
+ "- * to be referenced again before it is swapped out.\n"
+ "- *\n"
+ "- * The inactive_anon ratio is the target ratio of ACTIVE_ANON to\n"
+ "- * INACTIVE_ANON pages on this zone's LRU, maintained by the\n"
+ "- * pageout code. A zone->inactive_ratio of 3 means 3:1 or 25% of\n"
+ "- * the anonymous pages are kept on the inactive list.\n"
+ "- *\n"
+ "- * total     target    max\n"
+ "- * memory    ratio     inactive anon\n"
+ "- * -------------------------------------\n"
+ "- *   10MB       1         5MB\n"
+ "- *  100MB       1        50MB\n"
+ "- *    1GB       3       250MB\n"
+ "- *   10GB      10       0.9GB\n"
+ "- *  100GB      31         3GB\n"
+ "- *    1TB     101        10GB\n"
+ "- *   10TB     320        32GB\n"
+ "- */\n"
+ "-static void __meminit calculate_zone_inactive_ratio(struct zone *zone)\n"
+ "-{\n"
+ "-\tunsigned int gb, ratio;\n"
+ "-\n"
+ "-\t/* Zone size in gigabytes */\n"
+ "-\tgb = zone->managed_pages >> (30 - PAGE_SHIFT);\n"
+ "-\tif (gb)\n"
+ "-\t\tratio = int_sqrt(10 * gb);\n"
+ "-\telse\n"
+ "-\t\tratio = 1;\n"
+ "-\n"
+ "-\tzone->inactive_ratio = ratio;\n"
+ "-}\n"
+ "-\n"
+ "-static void __meminit setup_per_zone_inactive_ratio(void)\n"
+ "-{\n"
+ "-\tstruct zone *zone;\n"
+ "-\n"
+ "-\tfor_each_zone(zone)\n"
+ "-\t\tcalculate_zone_inactive_ratio(zone);\n"
+ "-}\n"
+ "-\n"
+ "-/*\n"
+ "  * Initialise min_free_kbytes.\n"
+ "  *\n"
+ "  * For small machines we want it small (128k min).  For large machines\n"
+ "@@ -6526,7 +6483,6 @@ int __meminit init_per_zone_wmark_min(void)\n"
+ " \tsetup_per_zone_wmarks();\n"
+ " \trefresh_zone_stat_thresholds();\n"
+ " \tsetup_per_zone_lowmem_reserve();\n"
+ "-\tsetup_per_zone_inactive_ratio();\n"
+ " \treturn 0;\n"
+ " }\n"
+ " module_init(init_per_zone_wmark_min)\n"
+ "diff --git a/mm/vmscan.c b/mm/vmscan.c\n"
+ "index 86eb214..1585579 100644\n"
+ "--- a/mm/vmscan.c\n"
+ "+++ b/mm/vmscan.c\n"
+ "@@ -1865,83 +1865,63 @@ static void shrink_active_list(unsigned long nr_to_scan,\n"
+ " \tfree_hot_cold_page_list(&l_hold, true);\n"
+ " }\n"
+ " \n"
+ "-#ifdef CONFIG_SWAP\n"
+ "-static bool inactive_anon_is_low_global(struct zone *zone)\n"
+ "-{\n"
+ "-\tunsigned long active, inactive;\n"
+ "-\n"
+ "-\tactive = zone_page_state(zone, NR_ACTIVE_ANON);\n"
+ "-\tinactive = zone_page_state(zone, NR_INACTIVE_ANON);\n"
+ "-\n"
+ "-\treturn inactive * zone->inactive_ratio < active;\n"
+ "-}\n"
+ "-\n"
+ "-/**\n"
+ "- * inactive_anon_is_low - check if anonymous pages need to be deactivated\n"
+ "- * @lruvec: LRU vector to check\n"
+ "+/*\n"
+ "+ * The inactive anon list should be small enough that the VM never has\n"
+ "+ * to do too much work.\n"
+ "  *\n"
+ "- * Returns true if the zone does not have enough inactive anon pages,\n"
+ "- * meaning some active anon pages need to be deactivated.\n"
+ "- */\n"
+ "-static bool inactive_anon_is_low(struct lruvec *lruvec)\n"
+ "-{\n"
+ "-\t/*\n"
+ "-\t * If we don't have swap space, anonymous page deactivation\n"
+ "-\t * is pointless.\n"
+ "-\t */\n"
+ "-\tif (!total_swap_pages)\n"
+ "-\t\treturn false;\n"
+ "-\n"
+ "-\tif (!mem_cgroup_disabled())\n"
+ "-\t\treturn mem_cgroup_inactive_anon_is_low(lruvec);\n"
+ "-\n"
+ "-\treturn inactive_anon_is_low_global(lruvec_zone(lruvec));\n"
+ "-}\n"
+ "-#else\n"
+ "-static inline bool inactive_anon_is_low(struct lruvec *lruvec)\n"
+ "-{\n"
+ "-\treturn false;\n"
+ "-}\n"
+ "-#endif\n"
+ "-\n"
+ "-/**\n"
+ "- * inactive_file_is_low - check if file pages need to be deactivated\n"
+ "- * @lruvec: LRU vector to check\n"
+ "+ * The inactive file list should be small enough to leave most memory\n"
+ "+ * to the established workingset on the scan-resistant active list,\n"
+ "+ * but large enough to avoid thrashing the aggregate readahead window.\n"
+ "  *\n"
+ "- * When the system is doing streaming IO, memory pressure here\n"
+ "- * ensures that active file pages get deactivated, until more\n"
+ "- * than half of the file pages are on the inactive list.\n"
+ "+ * Both inactive lists should also be large enough that each inactive\n"
+ "+ * page has a chance to be referenced again before it is reclaimed.\n"
+ "  *\n"
+ "- * Once we get to that situation, protect the system's working\n"
+ "- * set from being evicted by disabling active file page aging.\n"
+ "+ * The inactive_ratio is the target ratio of ACTIVE to INACTIVE pages\n"
+ "+ * on this LRU, maintained by the pageout code. A zone->inactive_ratio\n"
+ "+ * of 3 means 3:1 or 25% of the pages are kept on the inactive list.\n"
+ "  *\n"
+ "- * This uses a different ratio than the anonymous pages, because\n"
+ "- * the page cache uses a use-once replacement algorithm.\n"
+ "+ * total     target    max\n"
+ "+ * memory    ratio     inactive\n"
+ "+ * -------------------------------------\n"
+ "+ *   10MB       1         5MB\n"
+ "+ *  100MB       1        50MB\n"
+ "+ *    1GB       3       250MB\n"
+ "+ *   10GB      10       0.9GB\n"
+ "+ *  100GB      31         3GB\n"
+ "+ *    1TB     101        10GB\n"
+ "+ *   10TB     320        32GB\n"
+ "  */\n"
+ "-static bool inactive_file_is_low(struct lruvec *lruvec)\n"
+ "+static bool inactive_list_is_low(struct lruvec *lruvec, bool file)\n"
+ " {\n"
+ "+\tunsigned long inactive_ratio;\n"
+ " \tunsigned long inactive;\n"
+ " \tunsigned long active;\n"
+ "+\tunsigned long gb;\n"
+ " \n"
+ "-\tinactive = lruvec_lru_size(lruvec, LRU_INACTIVE_FILE);\n"
+ "-\tactive = lruvec_lru_size(lruvec, LRU_ACTIVE_FILE);\n"
+ "+\t/*\n"
+ "+\t * If we don't have swap space, anonymous page deactivation\n"
+ "+\t * is pointless.\n"
+ "+\t */\n"
+ "+\tif (!file && !total_swap_pages)\n"
+ "+\t\treturn false;\n"
+ " \n"
+ "-\treturn active > inactive;\n"
+ "-}\n"
+ "+\tinactive = lruvec_lru_size(lruvec, file * LRU_FILE);\n"
+ "+\tactive = lruvec_lru_size(lruvec, file * LRU_FILE + LRU_ACTIVE);\n"
+ " \n"
+ "-static bool inactive_list_is_low(struct lruvec *lruvec, enum lru_list lru)\n"
+ "-{\n"
+ "-\tif (is_file_lru(lru))\n"
+ "-\t\treturn inactive_file_is_low(lruvec);\n"
+ "+\tgb = (inactive + active) >> (30 - PAGE_SHIFT);\n"
+ "+\tif (gb)\n"
+ "+\t\tinactive_ratio = int_sqrt(10 * gb);\n"
+ " \telse\n"
+ "-\t\treturn inactive_anon_is_low(lruvec);\n"
+ "+\t\tinactive_ratio = 1;\n"
+ "+\n"
+ "+\treturn inactive * inactive_ratio < active;\n"
+ " }\n"
+ " \n"
+ " static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,\n"
+ " \t\t\t\t struct lruvec *lruvec, struct scan_control *sc)\n"
+ " {\n"
+ " \tif (is_active_lru(lru)) {\n"
+ "-\t\tif (inactive_list_is_low(lruvec, lru))\n"
+ "+\t\tif (inactive_list_is_low(lruvec, is_file_lru(lru)))\n"
+ " \t\t\tshrink_active_list(nr_to_scan, lruvec, sc, lru);\n"
+ " \t\treturn 0;\n"
+ " \t}\n"
+ "@@ -2062,7 +2042,7 @@ static void get_scan_count(struct lruvec *lruvec, struct mem_cgroup *memcg,\n"
+ " \t * lruvec even if it has plenty of old anonymous pages unless the\n"
+ " \t * system is under heavy pressure.\n"
+ " \t */\n"
+ "-\tif (!inactive_file_is_low(lruvec) &&\n"
+ "+\tif (!inactive_list_is_low(lruvec, true) &&\n"
+ " \t    lruvec_lru_size(lruvec, LRU_INACTIVE_FILE) >> sc->priority) {\n"
+ " \t\tscan_balance = SCAN_FILE;\n"
+ " \t\tgoto out;\n"
+ "@@ -2304,7 +2284,7 @@ static void shrink_zone_memcg(struct zone *zone, struct mem_cgroup *memcg,\n"
+ " \t * Even if we did not try to evict anon pages at all, we want to\n"
+ " \t * rebalance the anon lru active/inactive ratio.\n"
+ " \t */\n"
+ "-\tif (inactive_anon_is_low(lruvec))\n"
+ "+\tif (inactive_list_is_low(lruvec, false))\n"
+ " \t\tshrink_active_list(SWAP_CLUSTER_MAX, lruvec,\n"
+ " \t\t\t\t   sc, LRU_ACTIVE_ANON);\n"
+ " \n"
+ "@@ -2948,7 +2928,7 @@ static void age_active_anon(struct zone *zone, struct scan_control *sc)\n"
+ " \tdo {\n"
+ " \t\tstruct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg);\n"
+ " \n"
+ "-\t\tif (inactive_anon_is_low(lruvec))\n"
+ "+\t\tif (inactive_list_is_low(lruvec, false))\n"
+ " \t\t\tshrink_active_list(SWAP_CLUSTER_MAX, lruvec,\n"
+ " \t\t\t\t\t   sc, LRU_ACTIVE_ANON);\n"
+ " \n"
+ "-- \n"
+ 2.7.0
 
-e925f8b3341666963b4367dc492555e0d5943079dfbde8ab16d6d47ba434046f
+374f7e1b0c05a1ccba1991485052786313f579b8c3ac866f6fd51c2d8cb92b42

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.