aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2005-10-29 21:16:06 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 00:40:38 -0400
commitfd3e42fcc888a773572282575d2fdbf5cfd6216e (patch)
treeffe2c223b9200185eb67881582f784d534958883
parentae859762332f19bfc06f4c4a1b1fefb41e9e1084 (diff)
[PATCH] mm: dup_mmap use oldmm more
Use the parent's oldmm throughout dup_mmap, instead of perversely going back to current->mm. (Can you hear the sigh of relief from those mpnts? Usually I squash them, but not today.) Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--kernel/fork.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 2048ed7b5872..0e7fe4a8a8df 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -182,16 +182,16 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
182} 182}
183 183
184#ifdef CONFIG_MMU 184#ifdef CONFIG_MMU
185static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm) 185static inline int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
186{ 186{
187 struct vm_area_struct * mpnt, *tmp, **pprev; 187 struct vm_area_struct *mpnt, *tmp, **pprev;
188 struct rb_node **rb_link, *rb_parent; 188 struct rb_node **rb_link, *rb_parent;
189 int retval; 189 int retval;
190 unsigned long charge; 190 unsigned long charge;
191 struct mempolicy *pol; 191 struct mempolicy *pol;
192 192
193 down_write(&oldmm->mmap_sem); 193 down_write(&oldmm->mmap_sem);
194 flush_cache_mm(current->mm); 194 flush_cache_mm(oldmm);
195 mm->locked_vm = 0; 195 mm->locked_vm = 0;
196 mm->mmap = NULL; 196 mm->mmap = NULL;
197 mm->mmap_cache = NULL; 197 mm->mmap_cache = NULL;
@@ -204,7 +204,7 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm)
204 rb_parent = NULL; 204 rb_parent = NULL;
205 pprev = &mm->mmap; 205 pprev = &mm->mmap;
206 206
207 for (mpnt = current->mm->mmap ; mpnt ; mpnt = mpnt->vm_next) { 207 for (mpnt = oldmm->mmap; mpnt; mpnt = mpnt->vm_next) {
208 struct file *file; 208 struct file *file;
209 209
210 if (mpnt->vm_flags & VM_DONTCOPY) { 210 if (mpnt->vm_flags & VM_DONTCOPY) {
@@ -265,7 +265,7 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm)
265 rb_parent = &tmp->vm_rb; 265 rb_parent = &tmp->vm_rb;
266 266
267 mm->map_count++; 267 mm->map_count++;
268 retval = copy_page_range(mm, current->mm, tmp); 268 retval = copy_page_range(mm, oldmm, tmp);
269 spin_unlock(&mm->page_table_lock); 269 spin_unlock(&mm->page_table_lock);
270 270
271 if (tmp->vm_ops && tmp->vm_ops->open) 271 if (tmp->vm_ops && tmp->vm_ops->open)
@@ -277,7 +277,7 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm)
277 retval = 0; 277 retval = 0;
278 278
279out: 279out:
280 flush_tlb_mm(current->mm); 280 flush_tlb_mm(oldmm);
281 up_write(&oldmm->mmap_sem); 281 up_write(&oldmm->mmap_sem);
282 return retval; 282 return retval;
283fail_nomem_policy: 283fail_nomem_policy: