aboutsummaryrefslogtreecommitdiffstats
path: root/mm/shmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/shmem.c')
-rw-r--r--mm/shmem.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 5326876d814d..0b591c669b2d 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1187,16 +1187,19 @@ static void shmem_show_mpol(struct seq_file *seq, unsigned short policy,
1187static struct page *shmem_swapin(swp_entry_t entry, gfp_t gfp, 1187static struct page *shmem_swapin(swp_entry_t entry, gfp_t gfp,
1188 struct shmem_inode_info *info, unsigned long idx) 1188 struct shmem_inode_info *info, unsigned long idx)
1189{ 1189{
1190 struct mempolicy mpol, *spol;
1190 struct vm_area_struct pvma; 1191 struct vm_area_struct pvma;
1191 struct page *page; 1192 struct page *page;
1192 1193
1194 spol = mpol_cond_copy(&mpol,
1195 mpol_shared_policy_lookup(&info->policy, idx));
1196
1193 /* Create a pseudo vma that just contains the policy */ 1197 /* Create a pseudo vma that just contains the policy */
1194 pvma.vm_start = 0; 1198 pvma.vm_start = 0;
1195 pvma.vm_pgoff = idx; 1199 pvma.vm_pgoff = idx;
1196 pvma.vm_ops = NULL; 1200 pvma.vm_ops = NULL;
1197 pvma.vm_policy = mpol_shared_policy_lookup(&info->policy, idx); 1201 pvma.vm_policy = spol;
1198 page = swapin_readahead(entry, gfp, &pvma, 0); 1202 page = swapin_readahead(entry, gfp, &pvma, 0);
1199 mpol_put(pvma.vm_policy);
1200 return page; 1203 return page;
1201} 1204}
1202 1205
@@ -1204,16 +1207,17 @@ static struct page *shmem_alloc_page(gfp_t gfp,
1204 struct shmem_inode_info *info, unsigned long idx) 1207 struct shmem_inode_info *info, unsigned long idx)
1205{ 1208{
1206 struct vm_area_struct pvma; 1209 struct vm_area_struct pvma;
1207 struct page *page;
1208 1210
1209 /* Create a pseudo vma that just contains the policy */ 1211 /* Create a pseudo vma that just contains the policy */
1210 pvma.vm_start = 0; 1212 pvma.vm_start = 0;
1211 pvma.vm_pgoff = idx; 1213 pvma.vm_pgoff = idx;
1212 pvma.vm_ops = NULL; 1214 pvma.vm_ops = NULL;
1213 pvma.vm_policy = mpol_shared_policy_lookup(&info->policy, idx); 1215 pvma.vm_policy = mpol_shared_policy_lookup(&info->policy, idx);
1214 page = alloc_page_vma(gfp, &pvma, 0); 1216
1215 mpol_put(pvma.vm_policy); 1217 /*
1216 return page; 1218 * alloc_page_vma() will drop the shared policy reference
1219 */
1220 return alloc_page_vma(gfp, &pvma, 0);
1217} 1221}
1218#else /* !CONFIG_NUMA */ 1222#else /* !CONFIG_NUMA */
1219#ifdef CONFIG_TMPFS 1223#ifdef CONFIG_TMPFS