mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
mempolicy: remove the "task" arg of vma_policy_mof() and simplify it
1. vma_policy_mof(task) is simply not safe unless task == current, it can race with do_exit()->mpol_put(). Remove this arg and update its single caller. 2. vma can not be NULL, remove this check and simplify the code. Signed-off-by: Oleg Nesterov <[email protected]> Cc: KAMEZAWA Hiroyuki <[email protected]> Cc: David Rientjes <[email protected]> Cc: KOSAKI Motohiro <[email protected]> Cc: Alexander Viro <[email protected]> Cc: Cyrill Gorcunov <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Naoya Horiguchi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
8d90274b3b
commit
6b6482bbf6
3 changed files with 13 additions and 16 deletions
|
|
@ -1646,27 +1646,24 @@ struct mempolicy *get_vma_policy(struct task_struct *task,
|
|||
return pol;
|
||||
}
|
||||
|
||||
bool vma_policy_mof(struct task_struct *task, struct vm_area_struct *vma)
|
||||
bool vma_policy_mof(struct vm_area_struct *vma)
|
||||
{
|
||||
struct mempolicy *pol = NULL;
|
||||
struct mempolicy *pol;
|
||||
|
||||
if (vma) {
|
||||
if (vma->vm_ops && vma->vm_ops->get_policy) {
|
||||
bool ret = false;
|
||||
if (vma->vm_ops && vma->vm_ops->get_policy) {
|
||||
bool ret = false;
|
||||
|
||||
pol = vma->vm_ops->get_policy(vma, vma->vm_start);
|
||||
if (pol && (pol->flags & MPOL_F_MOF))
|
||||
ret = true;
|
||||
mpol_cond_put(pol);
|
||||
pol = vma->vm_ops->get_policy(vma, vma->vm_start);
|
||||
if (pol && (pol->flags & MPOL_F_MOF))
|
||||
ret = true;
|
||||
mpol_cond_put(pol);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
pol = vma->vm_policy;
|
||||
return ret;
|
||||
}
|
||||
|
||||
pol = vma->vm_policy;
|
||||
if (!pol)
|
||||
pol = get_task_policy(task);
|
||||
pol = get_task_policy(current);
|
||||
|
||||
return pol->flags & MPOL_F_MOF;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue