diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2007-10-17 02:25:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:42:45 -0400 |
commit | 3e26c149c358529b1605f8959341d34bc4b880a3 (patch) | |
tree | 9d173b1753b86bcf03a8591e2509e3162234447c /kernel/fork.c | |
parent | 04fbfdc14e5f48463820d6b9807daa5e9c92c51f (diff) |
mm: dirty balancing for tasks
Based on ideas of Andrew:
http://marc.info/?l=linux-kernel&m=102912915020543&w=2
Scale the bdi dirty limit inversly with the tasks dirty rate.
This makes heavy writers have a lower dirty limit than the occasional writer.
Andrea proposed something similar:
http://lwn.net/Articles/152277/
The main disadvantage to his patch is that he uses an unrelated quantity to
measure time, which leaves him with a workload dependant tunable. Other than
that the two approaches appear quite similar.
[akpm@linux-foundation.org: fix warning]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 3fc3c1383912..163325af8179 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -107,6 +107,7 @@ static struct kmem_cache *mm_cachep; | |||
107 | 107 | ||
108 | void free_task(struct task_struct *tsk) | 108 | void free_task(struct task_struct *tsk) |
109 | { | 109 | { |
110 | prop_local_destroy_single(&tsk->dirties); | ||
110 | free_thread_info(tsk->stack); | 111 | free_thread_info(tsk->stack); |
111 | rt_mutex_debug_task_free(tsk); | 112 | rt_mutex_debug_task_free(tsk); |
112 | free_task_struct(tsk); | 113 | free_task_struct(tsk); |
@@ -163,6 +164,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) | |||
163 | { | 164 | { |
164 | struct task_struct *tsk; | 165 | struct task_struct *tsk; |
165 | struct thread_info *ti; | 166 | struct thread_info *ti; |
167 | int err; | ||
166 | 168 | ||
167 | prepare_to_copy(orig); | 169 | prepare_to_copy(orig); |
168 | 170 | ||
@@ -178,6 +180,14 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) | |||
178 | 180 | ||
179 | *tsk = *orig; | 181 | *tsk = *orig; |
180 | tsk->stack = ti; | 182 | tsk->stack = ti; |
183 | |||
184 | err = prop_local_init_single(&tsk->dirties); | ||
185 | if (err) { | ||
186 | free_thread_info(ti); | ||
187 | free_task_struct(tsk); | ||
188 | return NULL; | ||
189 | } | ||
190 | |||
181 | setup_thread_stack(tsk, orig); | 191 | setup_thread_stack(tsk, orig); |
182 | 192 | ||
183 | #ifdef CONFIG_CC_STACKPROTECTOR | 193 | #ifdef CONFIG_CC_STACKPROTECTOR |