diff options
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r-- | mm/vmscan.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 9149444f947d..71f23c0c1090 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -11,6 +11,8 @@ | |||
11 | * Multiqueue VM started 5.8.00, Rik van Riel. | 11 | * Multiqueue VM started 5.8.00, Rik van Riel. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
15 | |||
14 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
15 | #include <linux/module.h> | 17 | #include <linux/module.h> |
16 | #include <linux/gfp.h> | 18 | #include <linux/gfp.h> |
@@ -43,6 +45,7 @@ | |||
43 | #include <linux/sysctl.h> | 45 | #include <linux/sysctl.h> |
44 | #include <linux/oom.h> | 46 | #include <linux/oom.h> |
45 | #include <linux/prefetch.h> | 47 | #include <linux/prefetch.h> |
48 | #include <linux/printk.h> | ||
46 | 49 | ||
47 | #include <asm/tlbflush.h> | 50 | #include <asm/tlbflush.h> |
48 | #include <asm/div64.h> | 51 | #include <asm/div64.h> |
@@ -83,6 +86,9 @@ struct scan_control { | |||
83 | /* Scan (total_size >> priority) pages at once */ | 86 | /* Scan (total_size >> priority) pages at once */ |
84 | int priority; | 87 | int priority; |
85 | 88 | ||
89 | /* anon vs. file LRUs scanning "ratio" */ | ||
90 | int swappiness; | ||
91 | |||
86 | /* | 92 | /* |
87 | * The memory cgroup that hit its limit and as a result is the | 93 | * The memory cgroup that hit its limit and as a result is the |
88 | * primary target of this reclaim invocation. | 94 | * primary target of this reclaim invocation. |
@@ -477,7 +483,7 @@ static pageout_t pageout(struct page *page, struct address_space *mapping, | |||
477 | if (page_has_private(page)) { | 483 | if (page_has_private(page)) { |
478 | if (try_to_free_buffers(page)) { | 484 | if (try_to_free_buffers(page)) { |
479 | ClearPageDirty(page); | 485 | ClearPageDirty(page); |
480 | printk("%s: orphaned page\n", __func__); | 486 | pr_info("%s: orphaned page\n", __func__); |
481 | return PAGE_CLEAN; | 487 | return PAGE_CLEAN; |
482 | } | 488 | } |
483 | } | 489 | } |
@@ -1845,13 +1851,6 @@ static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan, | |||
1845 | return shrink_inactive_list(nr_to_scan, lruvec, sc, lru); | 1851 | return shrink_inactive_list(nr_to_scan, lruvec, sc, lru); |
1846 | } | 1852 | } |
1847 | 1853 | ||
1848 | static int vmscan_swappiness(struct scan_control *sc) | ||
1849 | { | ||
1850 | if (global_reclaim(sc)) | ||
1851 | return vm_swappiness; | ||
1852 | return mem_cgroup_swappiness(sc->target_mem_cgroup); | ||
1853 | } | ||
1854 | |||
1855 | enum scan_balance { | 1854 | enum scan_balance { |
1856 | SCAN_EQUAL, | 1855 | SCAN_EQUAL, |
1857 | SCAN_FRACT, | 1856 | SCAN_FRACT, |
@@ -1912,7 +1911,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, | |||
1912 | * using the memory controller's swap limit feature would be | 1911 | * using the memory controller's swap limit feature would be |
1913 | * too expensive. | 1912 | * too expensive. |
1914 | */ | 1913 | */ |
1915 | if (!global_reclaim(sc) && !vmscan_swappiness(sc)) { | 1914 | if (!global_reclaim(sc) && !sc->swappiness) { |
1916 | scan_balance = SCAN_FILE; | 1915 | scan_balance = SCAN_FILE; |
1917 | goto out; | 1916 | goto out; |
1918 | } | 1917 | } |
@@ -1922,7 +1921,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, | |||
1922 | * system is close to OOM, scan both anon and file equally | 1921 | * system is close to OOM, scan both anon and file equally |
1923 | * (unless the swappiness setting disagrees with swapping). | 1922 | * (unless the swappiness setting disagrees with swapping). |
1924 | */ | 1923 | */ |
1925 | if (!sc->priority && vmscan_swappiness(sc)) { | 1924 | if (!sc->priority && sc->swappiness) { |
1926 | scan_balance = SCAN_EQUAL; | 1925 | scan_balance = SCAN_EQUAL; |
1927 | goto out; | 1926 | goto out; |
1928 | } | 1927 | } |
@@ -1965,7 +1964,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, | |||
1965 | * With swappiness at 100, anonymous and file have the same priority. | 1964 | * With swappiness at 100, anonymous and file have the same priority. |
1966 | * This scanning priority is essentially the inverse of IO cost. | 1965 | * This scanning priority is essentially the inverse of IO cost. |
1967 | */ | 1966 | */ |
1968 | anon_prio = vmscan_swappiness(sc); | 1967 | anon_prio = sc->swappiness; |
1969 | file_prio = 200 - anon_prio; | 1968 | file_prio = 200 - anon_prio; |
1970 | 1969 | ||
1971 | /* | 1970 | /* |
@@ -2265,6 +2264,7 @@ static void shrink_zone(struct zone *zone, struct scan_control *sc) | |||
2265 | 2264 | ||
2266 | lruvec = mem_cgroup_zone_lruvec(zone, memcg); | 2265 | lruvec = mem_cgroup_zone_lruvec(zone, memcg); |
2267 | 2266 | ||
2267 | sc->swappiness = mem_cgroup_swappiness(memcg); | ||
2268 | shrink_lruvec(lruvec, sc); | 2268 | shrink_lruvec(lruvec, sc); |
2269 | 2269 | ||
2270 | /* | 2270 | /* |
@@ -2731,6 +2731,7 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *memcg, | |||
2731 | .may_swap = !noswap, | 2731 | .may_swap = !noswap, |
2732 | .order = 0, | 2732 | .order = 0, |
2733 | .priority = 0, | 2733 | .priority = 0, |
2734 | .swappiness = mem_cgroup_swappiness(memcg), | ||
2734 | .target_mem_cgroup = memcg, | 2735 | .target_mem_cgroup = memcg, |
2735 | }; | 2736 | }; |
2736 | struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg); | 2737 | struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg); |
@@ -3372,7 +3373,10 @@ static int kswapd(void *p) | |||
3372 | } | 3373 | } |
3373 | } | 3374 | } |
3374 | 3375 | ||
3376 | tsk->flags &= ~(PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD); | ||
3375 | current->reclaim_state = NULL; | 3377 | current->reclaim_state = NULL; |
3378 | lockdep_clear_current_reclaim_state(); | ||
3379 | |||
3376 | return 0; | 3380 | return 0; |
3377 | } | 3381 | } |
3378 | 3382 | ||