diff options
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 46 |
1 files changed, 1 insertions, 45 deletions
diff --git a/mm/memory.c b/mm/memory.c index e65f8fc8ea67..430a72ed08d5 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1228,50 +1228,6 @@ int vm_insert_page(struct vm_area_struct *vma, unsigned long addr, struct page * | |||
1228 | EXPORT_SYMBOL(vm_insert_page); | 1228 | EXPORT_SYMBOL(vm_insert_page); |
1229 | 1229 | ||
1230 | /* | 1230 | /* |
1231 | * Somebody does a pfn remapping that doesn't actually work as a vma. | ||
1232 | * | ||
1233 | * Do it as individual pages instead, and warn about it. It's bad form, | ||
1234 | * and very inefficient. | ||
1235 | */ | ||
1236 | static int incomplete_pfn_remap(struct vm_area_struct *vma, | ||
1237 | unsigned long start, unsigned long end, | ||
1238 | unsigned long pfn, pgprot_t prot) | ||
1239 | { | ||
1240 | static int warn = 10; | ||
1241 | struct page *page; | ||
1242 | int retval; | ||
1243 | |||
1244 | if (!(vma->vm_flags & VM_INCOMPLETE)) { | ||
1245 | if (warn) { | ||
1246 | warn--; | ||
1247 | printk("%s does an incomplete pfn remapping", current->comm); | ||
1248 | dump_stack(); | ||
1249 | } | ||
1250 | } | ||
1251 | vma->vm_flags |= VM_INCOMPLETE | VM_IO | VM_RESERVED; | ||
1252 | |||
1253 | if (start < vma->vm_start || end > vma->vm_end) | ||
1254 | return -EINVAL; | ||
1255 | |||
1256 | if (!pfn_valid(pfn)) | ||
1257 | return -EINVAL; | ||
1258 | |||
1259 | page = pfn_to_page(pfn); | ||
1260 | if (!PageReserved(page)) | ||
1261 | return -EINVAL; | ||
1262 | |||
1263 | retval = 0; | ||
1264 | while (start < end) { | ||
1265 | retval = insert_page(vma->vm_mm, start, page, prot); | ||
1266 | if (retval < 0) | ||
1267 | break; | ||
1268 | start += PAGE_SIZE; | ||
1269 | page++; | ||
1270 | } | ||
1271 | return retval; | ||
1272 | } | ||
1273 | |||
1274 | /* | ||
1275 | * maps a range of physical memory into the requested pages. the old | 1231 | * maps a range of physical memory into the requested pages. the old |
1276 | * mappings are removed. any references to nonexistent pages results | 1232 | * mappings are removed. any references to nonexistent pages results |
1277 | * in null mappings (currently treated as "copy-on-access") | 1233 | * in null mappings (currently treated as "copy-on-access") |
@@ -1365,7 +1321,7 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr, | |||
1365 | */ | 1321 | */ |
1366 | if (!(vma->vm_flags & VM_SHARED)) { | 1322 | if (!(vma->vm_flags & VM_SHARED)) { |
1367 | if (addr != vma->vm_start || end != vma->vm_end) | 1323 | if (addr != vma->vm_start || end != vma->vm_end) |
1368 | return incomplete_pfn_remap(vma, addr, end, pfn, prot); | 1324 | return -EINVAL; |
1369 | vma->vm_pgoff = pfn; | 1325 | vma->vm_pgoff = pfn; |
1370 | } | 1326 | } |
1371 | 1327 | ||