diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-12-07 07:49:48 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-12-07 07:49:51 +0100 |
commit | 10a18d7dc0d9f12483c95ffc234118e9b80edfeb (patch) | |
tree | 0f43620107d5231cab669bca4b3c923b721330c7 /fs/exec.c | |
parent | f984ba4eb575e4a27ed28a76d4126d2aa9233c32 (diff) | |
parent | cf7d7e5a1980d1116ee152d25dac382b112b9c17 (diff) | |
download | linux-10a18d7dc0d9f12483c95ffc234118e9b80edfeb.tar.bz2 |
Merge commit 'v2.6.37-rc5' into perf/core
Merge reason: Pick up the latest -rc.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/fs/exec.c b/fs/exec.c index 99d33a1371e9..d68c378a3137 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -164,7 +164,26 @@ out: #ifdef CONFIG_MMU -static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, +void acct_arg_size(struct linux_binprm *bprm, unsigned long pages) +{ + struct mm_struct *mm = current->mm; + long diff = (long)(pages - bprm->vma_pages); + + if (!mm || !diff) + return; + + bprm->vma_pages = pages; + +#ifdef SPLIT_RSS_COUNTING + add_mm_counter(mm, MM_ANONPAGES, diff); +#else + spin_lock(&mm->page_table_lock); + add_mm_counter(mm, MM_ANONPAGES, diff); + spin_unlock(&mm->page_table_lock); +#endif +} + +struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, int write) { struct page *page; @@ -186,6 +205,8 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start; struct rlimit *rlim; + acct_arg_size(bprm, size / PAGE_SIZE); + /* * We've historically supported up to 32 pages (ARG_MAX) * of argument strings even with small stacks @@ -276,7 +297,11 @@ static bool valid_arg_len(struct linux_binprm *bprm, long len) #else -static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, +void acct_arg_size(struct linux_binprm *bprm, unsigned long pages) +{ +} + +struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, int write) { struct page *page; @@ -1003,6 +1028,7 @@ int flush_old_exec(struct linux_binprm * bprm) /* * Release all of the old mmap stuff */ + acct_arg_size(bprm, 0); retval = exec_mmap(bprm->mm); if (retval) goto out; @@ -1426,8 +1452,10 @@ int do_execve(const char * filename, return retval; out: - if (bprm->mm) - mmput (bprm->mm); + if (bprm->mm) { + acct_arg_size(bprm, 0); + mmput(bprm->mm); + } out_file: if (bprm->file) { |