Skip to contentSkip to conversation

vmalloc: use list of pages instead of array in vm_struct

PATCH In review Oleg Nesterov 1 participant 1 message Mar 6, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 5/5 vmalloc: use list of pages instead of array in vm_struct

This patch assumes that there is no valid usage of vmalloced_or_vmaped_page->lru.

In such a case vm_struct->array could be eliminated. It saves some memory and simplifies code a bit.

In vmap/vunmap case vm_struct->page_list is used only in map_vm_area(), so it is ok to do:

	addr1 = vmap(pages, count);
	addr2 = vmap(pages, count);
	...
	vunmap(addr1);
	vunmap(addr2);
include/linux/vmalloc.h renamed from include/linux/1_vmalloc.h +4 -4
@@ -2,6 +2,7 @@
 #define _LINUX_VMALLOC_H
 
 #include <linux/spinlock.h>
+#include <linux/list.h>
 #include <asm/page.h>		/* pgprot_t */
 
 /* bits in vm_struct->flags */
@@ -14,8 +15,7 @@ struct vm_struct {
 	void			*addr;
 	unsigned long		size;
 	unsigned long		flags;
-	struct page		**pages;
-	unsigned int		nr_pages;
+	struct list_head	page_list;
 	unsigned long		phys_addr;
 	struct vm_struct	*next;
 };
@@ -30,6 +30,7 @@ extern void *__vmalloc(unsigned long siz
 extern void *__vmalloc_area(struct vm_struct *area, int gfp_mask, pgprot_t prot);
 extern void vfree(void *addr);
 
+struct page;
 extern void *vmap(struct page **pages, unsigned int count,
 			unsigned long flags, pgprot_t prot);
 extern void vunmap(void *addr);
@@ -41,8 +42,7 @@ extern struct vm_struct *get_vm_area(uns
 extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
 					unsigned long start, unsigned long end);
 extern struct vm_struct *remove_vm_area(void *addr);
-extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
-			struct page ***pages);
+extern int map_vm_area(struct vm_struct *area, pgprot_t prot);
 extern void unmap_vm_area(struct vm_struct *area);
 
 /*
mm/vmalloc.c renamed from mm/1_vmalloc.c +31 -51

160 lines not on this page · raw message