aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/mm.h1
-rw-r--r--mm/memory.c46
2 files changed, 1 insertions, 46 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 29f02d8513f6..e5677f456742 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -163,7 +163,6 @@ extern unsigned int kobjsize(const void *objp);
163#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ 163#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
164#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ 164#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */
165#define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ 165#define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */
166#define VM_INCOMPLETE 0x02000000 /* Strange partial PFN mapping marker */
167 166
168#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 167#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
169#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 168#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
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 *
1228EXPORT_SYMBOL(vm_insert_page); 1228EXPORT_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 */
1236static 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