diff options
Diffstat (limited to 'mm/thrash.c')
-rw-r--r-- | mm/thrash.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/mm/thrash.c b/mm/thrash.c index 17d9e29e4c9c..fabf2d0f5169 100644 --- a/mm/thrash.c +++ b/mm/thrash.c | |||
@@ -25,10 +25,13 @@ | |||
25 | 25 | ||
26 | #include <trace/events/vmscan.h> | 26 | #include <trace/events/vmscan.h> |
27 | 27 | ||
28 | #define TOKEN_AGING_INTERVAL (0xFF) | ||
29 | |||
28 | static DEFINE_SPINLOCK(swap_token_lock); | 30 | static DEFINE_SPINLOCK(swap_token_lock); |
29 | struct mm_struct *swap_token_mm; | 31 | struct mm_struct *swap_token_mm; |
30 | struct mem_cgroup *swap_token_memcg; | 32 | struct mem_cgroup *swap_token_memcg; |
31 | static unsigned int global_faults; | 33 | static unsigned int global_faults; |
34 | static unsigned int last_aging; | ||
32 | 35 | ||
33 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | 36 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR |
34 | static struct mem_cgroup *swap_token_memcg_from_mm(struct mm_struct *mm) | 37 | static struct mem_cgroup *swap_token_memcg_from_mm(struct mm_struct *mm) |
@@ -64,6 +67,11 @@ void grab_swap_token(struct mm_struct *mm) | |||
64 | if (!swap_token_mm) | 67 | if (!swap_token_mm) |
65 | goto replace_token; | 68 | goto replace_token; |
66 | 69 | ||
70 | if ((global_faults - last_aging) > TOKEN_AGING_INTERVAL) { | ||
71 | swap_token_mm->token_priority /= 2; | ||
72 | last_aging = global_faults; | ||
73 | } | ||
74 | |||
67 | if (mm == swap_token_mm) { | 75 | if (mm == swap_token_mm) { |
68 | mm->token_priority += 2; | 76 | mm->token_priority += 2; |
69 | goto update_priority; | 77 | goto update_priority; |
@@ -81,7 +89,7 @@ void grab_swap_token(struct mm_struct *mm) | |||
81 | goto replace_token; | 89 | goto replace_token; |
82 | 90 | ||
83 | update_priority: | 91 | update_priority: |
84 | trace_update_swap_token_priority(mm, old_prio); | 92 | trace_update_swap_token_priority(mm, old_prio, swap_token_mm); |
85 | 93 | ||
86 | out: | 94 | out: |
87 | mm->faultstamp = global_faults; | 95 | mm->faultstamp = global_faults; |
@@ -94,6 +102,7 @@ replace_token: | |||
94 | trace_replace_swap_token(swap_token_mm, mm); | 102 | trace_replace_swap_token(swap_token_mm, mm); |
95 | swap_token_mm = mm; | 103 | swap_token_mm = mm; |
96 | swap_token_memcg = swap_token_memcg_from_mm(mm); | 104 | swap_token_memcg = swap_token_memcg_from_mm(mm); |
105 | last_aging = global_faults; | ||
97 | goto out; | 106 | goto out; |
98 | } | 107 | } |
99 | 108 | ||