summaryrefslogtreecommitdiff
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2002-06-17 19:43:55 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-06-17 19:43:55 -0700
commitc8712aebdb2455a095d596c1a5a6af358b3efde3 (patch)
tree9587e727a015c93f88dfed57ecc573ca8a259c54 /mm/vmalloc.c
parentd9083ea2b8d34d827f77e3d8ceeb04c160a938ed (diff)
[PATCH] change_page_attr and AGP update
Add change_page_attr to change page attributes for the kernel linear map. Fix AGP driver to use change_page_attr for the AGP buffer. Clean up AGP driver a bit (only tested on i386/VIA+AMD) Change ioremap_nocache to use change_page_attr to avoid mappings with conflicting caching attributes.
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index f95ebed746b0..50cc6d13f0ff 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -195,6 +195,7 @@ struct vm_struct * get_vm_area(unsigned long size, unsigned long flags)
if (addr > VMALLOC_END-size)
goto out;
}
+ area->phys_addr = 0;
area->flags = flags;
area->addr = (void *)addr;
area->size = size;
@@ -209,9 +210,25 @@ out:
return NULL;
}
-void vfree(void * addr)
+struct vm_struct *remove_kernel_area(void *addr)
{
struct vm_struct **p, *tmp;
+ write_lock(&vmlist_lock);
+ for (p = &vmlist ; (tmp = *p) ; p = &tmp->next) {
+ if (tmp->addr == addr) {
+ *p = tmp->next;
+ write_unlock(&vmlist_lock);
+ return tmp;
+ }
+
+ }
+ write_unlock(&vmlist_lock);
+ return NULL;
+}
+
+void vfree(void * addr)
+{
+ struct vm_struct *tmp;
if (!addr)
return;
@@ -219,17 +236,12 @@ void vfree(void * addr)
printk(KERN_ERR "Trying to vfree() bad address (%p)\n", addr);
return;
}
- write_lock(&vmlist_lock);
- for (p = &vmlist ; (tmp = *p) ; p = &tmp->next) {
- if (tmp->addr == addr) {
- *p = tmp->next;
+ tmp = remove_kernel_area(addr);
+ if (tmp) {
vmfree_area_pages(VMALLOC_VMADDR(tmp->addr), tmp->size);
- write_unlock(&vmlist_lock);
kfree(tmp);
return;
}
- }
- write_unlock(&vmlist_lock);
printk(KERN_ERR "Trying to vfree() nonexistent vm area (%p)\n", addr);
}