diff options
-rw-r--r-- | ipc/shm.c | 5 | ||||
-rw-r--r-- | mm/mempolicy.c | 7 |
2 files changed, 9 insertions, 3 deletions
@@ -271,9 +271,10 @@ static struct mempolicy *shm_get_policy(struct vm_area_struct *vma, | |||
271 | 271 | ||
272 | if (sfd->vm_ops->get_policy) | 272 | if (sfd->vm_ops->get_policy) |
273 | pol = sfd->vm_ops->get_policy(vma, addr); | 273 | pol = sfd->vm_ops->get_policy(vma, addr); |
274 | else if (vma->vm_policy) | 274 | else if (vma->vm_policy) { |
275 | pol = vma->vm_policy; | 275 | pol = vma->vm_policy; |
276 | else | 276 | mpol_get(pol); /* get_vma_policy() expects this */ |
277 | } else | ||
277 | pol = current->mempolicy; | 278 | pol = current->mempolicy; |
278 | return pol; | 279 | return pol; |
279 | } | 280 | } |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 6c7ba1a63d23..3c3601121509 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -1296,7 +1296,9 @@ struct zonelist *huge_zonelist(struct vm_area_struct *vma, unsigned long addr, | |||
1296 | unsigned nid; | 1296 | unsigned nid; |
1297 | 1297 | ||
1298 | nid = interleave_nid(pol, vma, addr, HPAGE_SHIFT); | 1298 | nid = interleave_nid(pol, vma, addr, HPAGE_SHIFT); |
1299 | __mpol_free(pol); /* finished with pol */ | 1299 | if (unlikely(pol != &default_policy && |
1300 | pol != current->mempolicy)) | ||
1301 | __mpol_free(pol); /* finished with pol */ | ||
1300 | return NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_flags); | 1302 | return NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_flags); |
1301 | } | 1303 | } |
1302 | 1304 | ||
@@ -1360,6 +1362,9 @@ alloc_page_vma(gfp_t gfp, struct vm_area_struct *vma, unsigned long addr) | |||
1360 | unsigned nid; | 1362 | unsigned nid; |
1361 | 1363 | ||
1362 | nid = interleave_nid(pol, vma, addr, PAGE_SHIFT); | 1364 | nid = interleave_nid(pol, vma, addr, PAGE_SHIFT); |
1365 | if (unlikely(pol != &default_policy && | ||
1366 | pol != current->mempolicy)) | ||
1367 | __mpol_free(pol); /* finished with pol */ | ||
1363 | return alloc_page_interleave(gfp, 0, nid); | 1368 | return alloc_page_interleave(gfp, 0, nid); |
1364 | } | 1369 | } |
1365 | zl = zonelist_policy(gfp, pol); | 1370 | zl = zonelist_policy(gfp, pol); |