diff options
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r-- | mm/mempolicy.c | 7 |
1 files changed, 6 insertions, 1 deletions
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); |