aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2005-10-29 21:16:04 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 00:40:38 -0400
commit404351e67a9facb475abf1492245374a28d13e90 (patch)
tree5ef4e78b399b36a46eda339ad0cd27556fc5b9a2
parentfc2acab31be8e869b2d5f6de12f557f6f054f19c (diff)
[PATCH] mm: mm_init set_mm_counters
How is anon_rss initialized? In dup_mmap, and by mm_alloc's memset; but that's not so good if an mm_counter_t is a special type. And how is rss initialized? By set_mm_counter, all over the place. Come on, we just need to initialize them both at once by set_mm_counter in mm_init (which follows the memcpy when forking). 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--arch/mips/kernel/irixelf.c1
-rw-r--r--arch/sparc64/kernel/binfmt_aout32.c1
-rw-r--r--arch/x86_64/ia32/ia32_aout.c1
-rw-r--r--fs/binfmt_aout.c1
-rw-r--r--fs/binfmt_elf.c1
-rw-r--r--fs/binfmt_elf_fdpic.c7
-rw-r--r--fs/binfmt_flat.c1
-rw-r--r--fs/binfmt_som.c1
-rw-r--r--kernel/fork.c4
9 files changed, 2 insertions, 16 deletions
diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c
index 99262fe64560..7ce34d4aa220 100644
--- a/arch/mips/kernel/irixelf.c
+++ b/arch/mips/kernel/irixelf.c
@@ -697,7 +697,6 @@ static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs)
697 /* Do this so that we can load the interpreter, if need be. We will 697 /* Do this so that we can load the interpreter, if need be. We will
698 * change some of these later. 698 * change some of these later.
699 */ 699 */
700 set_mm_counter(current->mm, rss, 0);
701 setup_arg_pages(bprm, STACK_TOP, EXSTACK_DEFAULT); 700 setup_arg_pages(bprm, STACK_TOP, EXSTACK_DEFAULT);
702 current->mm->start_stack = bprm->p; 701 current->mm->start_stack = bprm->p;
703 702
diff --git a/arch/sparc64/kernel/binfmt_aout32.c b/arch/sparc64/kernel/binfmt_aout32.c
index b2854ef221d0..edf52d06b280 100644
--- a/arch/sparc64/kernel/binfmt_aout32.c
+++ b/arch/sparc64/kernel/binfmt_aout32.c
@@ -241,7 +241,6 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs)
241 current->mm->brk = ex.a_bss + 241 current->mm->brk = ex.a_bss +
242 (current->mm->start_brk = N_BSSADDR(ex)); 242 (current->mm->start_brk = N_BSSADDR(ex));
243 243
244 set_mm_counter(current->mm, rss, 0);
245 current->mm->mmap = NULL; 244 current->mm->mmap = NULL;
246 compute_creds(bprm); 245 compute_creds(bprm);
247 current->flags &= ~PF_FORKNOEXEC; 246 current->flags &= ~PF_FORKNOEXEC;
diff --git a/arch/x86_64/ia32/ia32_aout.c b/arch/x86_64/ia32/ia32_aout.c
index 3e6780fa0186..93c60f4aa47a 100644
--- a/arch/x86_64/ia32/ia32_aout.c
+++ b/arch/x86_64/ia32/ia32_aout.c
@@ -314,7 +314,6 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
314 current->mm->free_area_cache = TASK_UNMAPPED_BASE; 314 current->mm->free_area_cache = TASK_UNMAPPED_BASE;
315 current->mm->cached_hole_size = 0; 315 current->mm->cached_hole_size = 0;
316 316
317 set_mm_counter(current->mm, rss, 0);
318 current->mm->mmap = NULL; 317 current->mm->mmap = NULL;
319 compute_creds(bprm); 318 compute_creds(bprm);
320 current->flags &= ~PF_FORKNOEXEC; 319 current->flags &= ~PF_FORKNOEXEC;
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index dd9baabaf016..72011826f0cb 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -318,7 +318,6 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
318 current->mm->free_area_cache = current->mm->mmap_base; 318 current->mm->free_area_cache = current->mm->mmap_base;
319 current->mm->cached_hole_size = 0; 319 current->mm->cached_hole_size = 0;
320 320
321 set_mm_counter(current->mm, rss, 0);
322 current->mm->mmap = NULL; 321 current->mm->mmap = NULL;
323 compute_creds(bprm); 322 compute_creds(bprm);
324 current->flags &= ~PF_FORKNOEXEC; 323 current->flags &= ~PF_FORKNOEXEC;
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index d4b15576e584..918ccc267e41 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -773,7 +773,6 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
773 773
774 /* Do this so that we can load the interpreter, if need be. We will 774 /* Do this so that we can load the interpreter, if need be. We will
775 change some of these later */ 775 change some of these later */
776 set_mm_counter(current->mm, rss, 0);
777 current->mm->free_area_cache = current->mm->mmap_base; 776 current->mm->free_area_cache = current->mm->mmap_base;
778 current->mm->cached_hole_size = 0; 777 current->mm->cached_hole_size = 0;
779 retval = setup_arg_pages(bprm, randomize_stack_top(STACK_TOP), 778 retval = setup_arg_pages(bprm, randomize_stack_top(STACK_TOP),
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 134c9c0d1f54..dda87c4c82a3 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -294,14 +294,7 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm, struct pt_regs *regs
294 &interp_params, 294 &interp_params,
295 &current->mm->start_stack, 295 &current->mm->start_stack,
296 &current->mm->start_brk); 296 &current->mm->start_brk);
297#endif
298
299 /* do this so that we can load the interpreter, if need be
300 * - we will change some of these later
301 */
302 set_mm_counter(current->mm, rss, 0);
303 297
304#ifdef CONFIG_MMU
305 retval = setup_arg_pages(bprm, current->mm->start_stack, executable_stack); 298 retval = setup_arg_pages(bprm, current->mm->start_stack, executable_stack);
306 if (retval < 0) { 299 if (retval < 0) {
307 send_sig(SIGKILL, current, 0); 300 send_sig(SIGKILL, current, 0);
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 7974efa107bc..9d6625829b99 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -650,7 +650,6 @@ static int load_flat_file(struct linux_binprm * bprm,
650 current->mm->start_brk = datapos + data_len + bss_len; 650 current->mm->start_brk = datapos + data_len + bss_len;
651 current->mm->brk = (current->mm->start_brk + 3) & ~3; 651 current->mm->brk = (current->mm->start_brk + 3) & ~3;
652 current->mm->context.end_brk = memp + ksize((void *) memp) - stack_len; 652 current->mm->context.end_brk = memp + ksize((void *) memp) - stack_len;
653 set_mm_counter(current->mm, rss, 0);
654 } 653 }
655 654
656 if (flags & FLAT_FLAG_KTRACE) 655 if (flags & FLAT_FLAG_KTRACE)
diff --git a/fs/binfmt_som.c b/fs/binfmt_som.c
index 227a2682d2bf..00a91dc25d16 100644
--- a/fs/binfmt_som.c
+++ b/fs/binfmt_som.c
@@ -259,7 +259,6 @@ load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs)
259 create_som_tables(bprm); 259 create_som_tables(bprm);
260 260
261 current->mm->start_stack = bprm->p; 261 current->mm->start_stack = bprm->p;
262 set_mm_counter(current->mm, rss, 0);
263 262
264#if 0 263#if 0
265 printk("(start_brk) %08lx\n" , (unsigned long) current->mm->start_brk); 264 printk("(start_brk) %08lx\n" , (unsigned long) current->mm->start_brk);
diff --git a/kernel/fork.c b/kernel/fork.c
index e2ff11f8c1b0..25caa02e2eac 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -198,8 +198,6 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm)
198 mm->free_area_cache = oldmm->mmap_base; 198 mm->free_area_cache = oldmm->mmap_base;
199 mm->cached_hole_size = ~0UL; 199 mm->cached_hole_size = ~0UL;
200 mm->map_count = 0; 200 mm->map_count = 0;
201 set_mm_counter(mm, rss, 0);
202 set_mm_counter(mm, anon_rss, 0);
203 cpus_clear(mm->cpu_vm_mask); 201 cpus_clear(mm->cpu_vm_mask);
204 mm->mm_rb = RB_ROOT; 202 mm->mm_rb = RB_ROOT;
205 rb_link = &mm->mm_rb.rb_node; 203 rb_link = &mm->mm_rb.rb_node;
@@ -323,6 +321,8 @@ static struct mm_struct * mm_init(struct mm_struct * mm)
323 INIT_LIST_HEAD(&mm->mmlist); 321 INIT_LIST_HEAD(&mm->mmlist);
324 mm->core_waiters = 0; 322 mm->core_waiters = 0;
325 mm->nr_ptes = 0; 323 mm->nr_ptes = 0;
324 set_mm_counter(mm, rss, 0);
325 set_mm_counter(mm, anon_rss, 0);
326 spin_lock_init(&mm->page_table_lock); 326 spin_lock_init(&mm->page_table_lock);
327 rwlock_init(&mm->ioctx_list_lock); 327 rwlock_init(&mm->ioctx_list_lock);
328 mm->ioctx_list = NULL; 328 mm->ioctx_list = NULL;