diff options
author | Ingo Molnar <mingo@elte.hu> | 2011-08-04 03:09:27 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-08-04 03:09:27 -0400 |
commit | d7619fe39d9769b4d4545cc511c891deea18ae08 (patch) | |
tree | 0a902533414001075b2245825e145cc2e35ce985 /mm/thrash.c | |
parent | 9ea71503a8ed9184d2d0b8ccc4d269d05f7940ae (diff) | |
parent | ed8f37370d83e695c0a4fa5d5fc7a83ecb947526 (diff) |
Merge branch 'linus' into core/urgent
Diffstat (limited to 'mm/thrash.c')
-rw-r--r-- | mm/thrash.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/mm/thrash.c b/mm/thrash.c index fabf2d0f5169..e53f7d02c17c 100644 --- a/mm/thrash.c +++ b/mm/thrash.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Released under the GPL, see the file COPYING for details. | 6 | * Released under the GPL, see the file COPYING for details. |
7 | * | 7 | * |
8 | * Simple token based thrashing protection, using the algorithm | 8 | * Simple token based thrashing protection, using the algorithm |
9 | * described in: http://www.cs.wm.edu/~sjiang/token.pdf | 9 | * described in: http://www.cse.ohio-state.edu/hpcs/WWW/HTML/publications/abs05-1.html |
10 | * | 10 | * |
11 | * Sep 2006, Ashwin Chaugule <ashwin.chaugule@celunite.com> | 11 | * Sep 2006, Ashwin Chaugule <ashwin.chaugule@celunite.com> |
12 | * Improved algorithm to pass token: | 12 | * Improved algorithm to pass token: |
@@ -30,8 +30,6 @@ | |||
30 | static DEFINE_SPINLOCK(swap_token_lock); | 30 | static DEFINE_SPINLOCK(swap_token_lock); |
31 | struct mm_struct *swap_token_mm; | 31 | struct mm_struct *swap_token_mm; |
32 | struct mem_cgroup *swap_token_memcg; | 32 | struct mem_cgroup *swap_token_memcg; |
33 | static unsigned int global_faults; | ||
34 | static unsigned int last_aging; | ||
35 | 33 | ||
36 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | 34 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR |
37 | static struct mem_cgroup *swap_token_memcg_from_mm(struct mm_struct *mm) | 35 | static struct mem_cgroup *swap_token_memcg_from_mm(struct mm_struct *mm) |
@@ -55,6 +53,8 @@ void grab_swap_token(struct mm_struct *mm) | |||
55 | { | 53 | { |
56 | int current_interval; | 54 | int current_interval; |
57 | unsigned int old_prio = mm->token_priority; | 55 | unsigned int old_prio = mm->token_priority; |
56 | static unsigned int global_faults; | ||
57 | static unsigned int last_aging; | ||
58 | 58 | ||
59 | global_faults++; | 59 | global_faults++; |
60 | 60 | ||
@@ -67,6 +67,17 @@ void grab_swap_token(struct mm_struct *mm) | |||
67 | if (!swap_token_mm) | 67 | if (!swap_token_mm) |
68 | goto replace_token; | 68 | goto replace_token; |
69 | 69 | ||
70 | /* | ||
71 | * Usually, we don't need priority aging because long interval faults | ||
72 | * makes priority decrease quickly. But there is one exception. If the | ||
73 | * token owner task is sleeping, it never make long interval faults. | ||
74 | * Thus, we need a priority aging mechanism instead. The requirements | ||
75 | * of priority aging are | ||
76 | * 1) An aging interval is reasonable enough long. Too short aging | ||
77 | * interval makes quick swap token lost and decrease performance. | ||
78 | * 2) The swap token owner task have to get priority aging even if | ||
79 | * it's under sleep. | ||
80 | */ | ||
70 | if ((global_faults - last_aging) > TOKEN_AGING_INTERVAL) { | 81 | if ((global_faults - last_aging) > TOKEN_AGING_INTERVAL) { |
71 | swap_token_mm->token_priority /= 2; | 82 | swap_token_mm->token_priority /= 2; |
72 | last_aging = global_faults; | 83 | last_aging = global_faults; |