mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	mm: copy over oom_adj value at fork time
Fix a post-2.6.31 regression which was introduced by
2ff05b2b4e ("oom: move oom_adj value from
task_struct to mm_struct").
After moving the oom_adj value from the task struct to the mm_struct, the
oom_adj value was no longer properly inherited by child processes.
Copying over the oom_adj value at fork time fixes that bug.
[kosaki.motohiro@jp.fujitsu.com: test for current->mm before dereferencing it]
Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Paul Menage <manage@google.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
			
			
This commit is contained in:
		
							parent
							
								
									6583bb64fc
								
							
						
					
					
						commit
						933b787b57
					
				
					 1 changed files with 1 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -426,6 +426,7 @@ static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p)
 | 
			
		|||
	init_rwsem(&mm->mmap_sem);
 | 
			
		||||
	INIT_LIST_HEAD(&mm->mmlist);
 | 
			
		||||
	mm->flags = (current->mm) ? current->mm->flags : default_dump_filter;
 | 
			
		||||
	mm->oom_adj = (current->mm) ? current->mm->oom_adj : 0;
 | 
			
		||||
	mm->core_state = NULL;
 | 
			
		||||
	mm->nr_ptes = 0;
 | 
			
		||||
	set_mm_counter(mm, file_rss, 0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue