aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLee Schermerhorn <lee.schermerhorn@hp.com>2008-04-28 05:13:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 11:58:24 -0400
commitae4d8c16aa22775f5731677abb8a82f03cec877e (patch)
tree2d34c6fd334b51cc5f3265cd4ec26db758639b5c /mm
parentf4e53d910b7dde2685b177f1e7c3e3e0b4a42f7b (diff)
mempolicy: fixup Fallback for Default Shmem Policy
get_vma_policy() is not handling fallback to task policy correctly when the get_policy() vm_op returns NULL. The NULL overwrites the 'pol' variable that was holding the fallback task mempolicy. So, it was falling back directly to system default policy. Fix get_vma_policy() to use only non-NULL policy returned from the vma get_policy op. shm_get_policy() was falling back to current task's mempolicy if the "backing file system" [tmpfs vs hugetlbfs] does not support the get_policy vm_op and the vma policy is null. This is incorrect for show_numa_maps() which is likely querying the numa_maps of some task other than current. Remove this fallback. Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com> Cc: Christoph Lameter <clameter@sgi.com> Cc: David Rientjes <rientjes@google.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/mempolicy.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index c6c61ea6bb8c..8924aaf4665c 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1262,7 +1262,7 @@ asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len,
1262 * @task != current]. It is the caller's responsibility to 1262 * @task != current]. It is the caller's responsibility to
1263 * free the reference in these cases. 1263 * free the reference in these cases.
1264 */ 1264 */
1265static struct mempolicy * get_vma_policy(struct task_struct *task, 1265static struct mempolicy *get_vma_policy(struct task_struct *task,
1266 struct vm_area_struct *vma, unsigned long addr) 1266 struct vm_area_struct *vma, unsigned long addr)
1267{ 1267{
1268 struct mempolicy *pol = task->mempolicy; 1268 struct mempolicy *pol = task->mempolicy;
@@ -1270,7 +1270,10 @@ static struct mempolicy * get_vma_policy(struct task_struct *task,
1270 1270
1271 if (vma) { 1271 if (vma) {
1272 if (vma->vm_ops && vma->vm_ops->get_policy) { 1272 if (vma->vm_ops && vma->vm_ops->get_policy) {
1273 pol = vma->vm_ops->get_policy(vma, addr); 1273 struct mempolicy *vpol = vma->vm_ops->get_policy(vma,
1274 addr);
1275 if (vpol)
1276 pol = vpol;
1274 shared_pol = 1; /* if pol non-NULL, add ref below */ 1277 shared_pol = 1; /* if pol non-NULL, add ref below */
1275 } else if (vma->vm_policy && 1278 } else if (vma->vm_policy &&
1276 vma->vm_policy->policy != MPOL_DEFAULT) 1279 vma->vm_policy->policy != MPOL_DEFAULT)