Merge d5660df4a5
("Merge branch 'akpm' (patches from Andrew)") into android-mainline
steps on the way to 5.10-rc1 Change-Id: Iddc84c25b6a9d71fa8542b927d6f69c364131c3d Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -561,7 +561,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
|
||||
atomic_dec(&inode->i_writecount);
|
||||
i_mmap_lock_write(mapping);
|
||||
if (tmp->vm_flags & VM_SHARED)
|
||||
atomic_inc(&mapping->i_mmap_writable);
|
||||
mapping_allow_writable(mapping);
|
||||
flush_dcache_mmap_lock(mapping);
|
||||
/* insert tmp into the share list, just after mpnt */
|
||||
vma_interval_tree_insert_after(tmp, mpnt,
|
||||
@@ -592,7 +592,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
|
||||
|
||||
mm->map_count++;
|
||||
if (!(tmp->vm_flags & VM_WIPEONFORK))
|
||||
retval = copy_page_range(mm, oldmm, mpnt, tmp);
|
||||
retval = copy_page_range(tmp, mpnt);
|
||||
|
||||
if (tmp->vm_ops && tmp->vm_ops->open)
|
||||
tmp->vm_ops->open(tmp);
|
||||
@@ -1814,6 +1814,25 @@ static __always_inline void delayed_free_task(struct task_struct *tsk)
|
||||
free_task(tsk);
|
||||
}
|
||||
|
||||
static void copy_oom_score_adj(u64 clone_flags, struct task_struct *tsk)
|
||||
{
|
||||
/* Skip if kernel thread */
|
||||
if (!tsk->mm)
|
||||
return;
|
||||
|
||||
/* Skip if spawning a thread or using vfork */
|
||||
if ((clone_flags & (CLONE_VM | CLONE_THREAD | CLONE_VFORK)) != CLONE_VM)
|
||||
return;
|
||||
|
||||
/* We need to synchronize with __set_oom_adj */
|
||||
mutex_lock(&oom_adj_mutex);
|
||||
set_bit(MMF_MULTIPROCESS, &tsk->mm->flags);
|
||||
/* Update the values in case they were changed after copy_signal */
|
||||
tsk->signal->oom_score_adj = current->signal->oom_score_adj;
|
||||
tsk->signal->oom_score_adj_min = current->signal->oom_score_adj_min;
|
||||
mutex_unlock(&oom_adj_mutex);
|
||||
}
|
||||
|
||||
/*
|
||||
* This creates a new process as a copy of the old one,
|
||||
* but does not actually start it yet.
|
||||
@@ -2292,6 +2311,8 @@ static __latent_entropy struct task_struct *copy_process(
|
||||
trace_task_newtask(p, clone_flags);
|
||||
uprobe_copy_process(p, clone_flags);
|
||||
|
||||
copy_oom_score_adj(clone_flags, p);
|
||||
|
||||
return p;
|
||||
|
||||
bad_fork_cancel_cgroup:
|
||||
|
Reference in New Issue
Block a user