diff options
author | Oleg Nesterov <oleg@redhat.com> | 2014-10-09 18:27:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-09 22:25:56 -0400 |
commit | dd6eecb917938c1b7e505a83df307b3476e7c8bd (patch) | |
tree | bd0ce18990d7541222ff3150d0f6ba61bdb09c02 /mm/mempolicy.c | |
parent | 2c7c3a7d08b28278112f2aaa0b7cf53140101e2a (diff) |
mempolicy: unexport get_vma_policy() and remove its "task" arg
- get_vma_policy(task) is not safe if task != current, remove this
argument.
- get_vma_policy() no longer has callers outside of mempolicy.c,
make it static.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r-- | mm/mempolicy.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 9695a9a3ab90..008fb32936eb 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -1616,27 +1616,24 @@ struct mempolicy *__get_vma_policy(struct vm_area_struct *vma, | |||
1616 | } | 1616 | } |
1617 | 1617 | ||
1618 | /* | 1618 | /* |
1619 | * get_vma_policy(@task, @vma, @addr) | 1619 | * get_vma_policy(@vma, @addr) |
1620 | * @task: task for fallback if vma policy == default | ||
1621 | * @vma: virtual memory area whose policy is sought | 1620 | * @vma: virtual memory area whose policy is sought |
1622 | * @addr: address in @vma for shared policy lookup | 1621 | * @addr: address in @vma for shared policy lookup |
1623 | * | 1622 | * |
1624 | * Returns effective policy for a VMA at specified address. | 1623 | * Returns effective policy for a VMA at specified address. |
1625 | * Falls back to @task or system default policy, as necessary. | 1624 | * Falls back to current->mempolicy or system default policy, as necessary. |
1626 | * Current or other task's task mempolicy and non-shared vma policies must be | ||
1627 | * protected by task_lock(task) by the caller. | ||
1628 | * Shared policies [those marked as MPOL_F_SHARED] require an extra reference | 1625 | * Shared policies [those marked as MPOL_F_SHARED] require an extra reference |
1629 | * count--added by the get_policy() vm_op, as appropriate--to protect against | 1626 | * count--added by the get_policy() vm_op, as appropriate--to protect against |
1630 | * freeing by another task. It is the caller's responsibility to free the | 1627 | * freeing by another task. It is the caller's responsibility to free the |
1631 | * extra reference for shared policies. | 1628 | * extra reference for shared policies. |
1632 | */ | 1629 | */ |
1633 | struct mempolicy *get_vma_policy(struct task_struct *task, | 1630 | static struct mempolicy *get_vma_policy(struct vm_area_struct *vma, |
1634 | struct vm_area_struct *vma, unsigned long addr) | 1631 | unsigned long addr) |
1635 | { | 1632 | { |
1636 | struct mempolicy *pol = __get_vma_policy(vma, addr); | 1633 | struct mempolicy *pol = __get_vma_policy(vma, addr); |
1637 | 1634 | ||
1638 | if (!pol) | 1635 | if (!pol) |
1639 | pol = get_task_policy(task); | 1636 | pol = get_task_policy(current); |
1640 | 1637 | ||
1641 | return pol; | 1638 | return pol; |
1642 | } | 1639 | } |
@@ -1864,7 +1861,7 @@ struct zonelist *huge_zonelist(struct vm_area_struct *vma, unsigned long addr, | |||
1864 | { | 1861 | { |
1865 | struct zonelist *zl; | 1862 | struct zonelist *zl; |
1866 | 1863 | ||
1867 | *mpol = get_vma_policy(current, vma, addr); | 1864 | *mpol = get_vma_policy(vma, addr); |
1868 | *nodemask = NULL; /* assume !MPOL_BIND */ | 1865 | *nodemask = NULL; /* assume !MPOL_BIND */ |
1869 | 1866 | ||
1870 | if (unlikely((*mpol)->mode == MPOL_INTERLEAVE)) { | 1867 | if (unlikely((*mpol)->mode == MPOL_INTERLEAVE)) { |
@@ -2019,7 +2016,7 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, | |||
2019 | unsigned int cpuset_mems_cookie; | 2016 | unsigned int cpuset_mems_cookie; |
2020 | 2017 | ||
2021 | retry_cpuset: | 2018 | retry_cpuset: |
2022 | pol = get_vma_policy(current, vma, addr); | 2019 | pol = get_vma_policy(vma, addr); |
2023 | cpuset_mems_cookie = read_mems_allowed_begin(); | 2020 | cpuset_mems_cookie = read_mems_allowed_begin(); |
2024 | 2021 | ||
2025 | if (unlikely(pol->mode == MPOL_INTERLEAVE)) { | 2022 | if (unlikely(pol->mode == MPOL_INTERLEAVE)) { |
@@ -2285,7 +2282,7 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long | |||
2285 | 2282 | ||
2286 | BUG_ON(!vma); | 2283 | BUG_ON(!vma); |
2287 | 2284 | ||
2288 | pol = get_vma_policy(current, vma, addr); | 2285 | pol = get_vma_policy(vma, addr); |
2289 | if (!(pol->flags & MPOL_F_MOF)) | 2286 | if (!(pol->flags & MPOL_F_MOF)) |
2290 | goto out; | 2287 | goto out; |
2291 | 2288 | ||