diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-26 17:15:20 -0700 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-26 17:15:20 -0700 | 
| commit | 31453a9764f7e2a72a6e2c502ace586e2663a68c (patch) | |
| tree | 5d4db63de5b4b85d1ffdab4e95a75175a784a10a /kernel/fork.c | |
| parent | f9ba5375a8aae4aeea6be15df77e24707a429812 (diff) | |
| parent | 93ed0e2d07b25aff4db1d61bfbcd1e82074c0ad5 (diff) | |
Merge branch 'akpm-incoming-1'
* akpm-incoming-1: (176 commits)
  scripts/checkpatch.pl: add check for declaration of pci_device_id
  scripts/checkpatch.pl: add warnings for static char that could be static const char
  checkpatch: version 0.31
  checkpatch: statement/block context analyser should look at sanitised lines
  checkpatch: handle EXPORT_SYMBOL for DEVICE_ATTR and similar
  checkpatch: clean up structure definition macro handline
  checkpatch: update copyright dates
  checkpatch: Add additional attribute #defines
  checkpatch: check for incorrect permissions
  checkpatch: ensure kconfig help checks only apply when we are adding help
  checkpatch: simplify and consolidate "missing space after" checks
  checkpatch: add check for space after struct, union, and enum
  checkpatch: returning errno typically should be negative
  checkpatch: handle casts better fixing false categorisation of : as binary
  checkpatch: ensure we do not collapse bracketed sections into constants
  checkpatch: suggest cleanpatch and cleanfile when appropriate
  checkpatch: types may sit on a line on their own
  checkpatch: fix regressions in "fix handling of leading spaces"
  div64_u64(): improve precision on 32bit platforms
  lib/parser: cleanup match_number()
  ...
Diffstat (limited to 'kernel/fork.c')
| -rw-r--r-- | kernel/fork.c | 15 | 
1 files changed, 14 insertions, 1 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index c445f8cc408..e87aaaaf513 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -65,6 +65,7 @@  #include <linux/perf_event.h>  #include <linux/posix-timers.h>  #include <linux/user-return-notifier.h> +#include <linux/oom.h>  #include <asm/pgtable.h>  #include <asm/pgalloc.h> @@ -488,6 +489,7 @@ static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p)  	mm->cached_hole_size = ~0UL;  	mm_init_aio(mm);  	mm_init_owner(mm, p); +	atomic_set(&mm->oom_disable_count, 0);  	if (likely(!mm_alloc_pgd(mm))) {  		mm->def_flags = 0; @@ -741,6 +743,8 @@ good_mm:  	/* Initializing for Swap token stuff */  	mm->token_priority = 0;  	mm->last_interval = 0; +	if (tsk->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) +		atomic_inc(&mm->oom_disable_count);  	tsk->mm = mm;  	tsk->active_mm = mm; @@ -1299,8 +1303,13 @@ bad_fork_cleanup_io:  bad_fork_cleanup_namespaces:  	exit_task_namespaces(p);  bad_fork_cleanup_mm: -	if (p->mm) +	if (p->mm) { +		task_lock(p); +		if (p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) +			atomic_dec(&p->mm->oom_disable_count); +		task_unlock(p);  		mmput(p->mm); +	}  bad_fork_cleanup_signal:  	if (!(clone_flags & CLONE_THREAD))  		free_signal_struct(p->signal); @@ -1693,6 +1702,10 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)  			active_mm = current->active_mm;  			current->mm = new_mm;  			current->active_mm = new_mm; +			if (current->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) { +				atomic_dec(&mm->oom_disable_count); +				atomic_inc(&new_mm->oom_disable_count); +			}  			activate_mm(active_mm, new_mm);  			new_mm = mm;  		}  | 
