PERFORCE change 126436 for review

Kip Macy kmacy at FreeBSD.org
Sat Sep 15 12:40:49 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=126436

Change 126436 by kmacy at kmacy_home:ethng on 2007/09/15 19:40:01

	Allow architectures to define their own contigmalloc2 variant
	- this makes it possible for them to simply use the direct map 
	  rather than mapping each page on allocate and unmapping on free

Affected files ...

.. //depot/projects/ethng/src/sys/vm/vm_contig.c#2 edit
.. //depot/projects/ethng/src/sys/vm/vm_extern.h#2 edit

Differences ...

==== //depot/projects/ethng/src/sys/vm/vm_contig.c#2 (text+ko) ====

@@ -183,7 +183,8 @@
 	vm_page_unlock_queues();
 }
 
-static void *
+#ifndef VM_MD_CONTIG
+void *
 contigmalloc2(vm_page_t m, vm_pindex_t npages, int flags)
 {
 	vm_object_t object = kernel_object;
@@ -220,6 +221,17 @@
 	return ((void *)addr);
 }
 
+void
+contigfree(void *addr, unsigned long size, struct malloc_type *type)
+{
+	vm_pindex_t npgs;
+
+	npgs = round_page(size) >> PAGE_SHIFT;
+	kmem_free(kernel_map, (vm_offset_t)addr, size);
+	malloc_type_freed(type, npgs << PAGE_SHIFT);
+}
+#endif
+
 void *
 contigmalloc(
 	unsigned long size,	/* should be size_t here and for malloc() */
@@ -280,12 +292,3 @@
 	return (ret);
 }
 
-void
-contigfree(void *addr, unsigned long size, struct malloc_type *type)
-{
-	vm_pindex_t npgs;
-
-	npgs = round_page(size) >> PAGE_SHIFT;
-	kmem_free(kernel_map, (vm_offset_t)addr, size);
-	malloc_type_freed(type, npgs << PAGE_SHIFT);
-}

==== //depot/projects/ethng/src/sys/vm/vm_extern.h#2 (text+ko) ====

@@ -96,5 +96,7 @@
 void vm_thread_new_altkstack(struct thread *td, int pages);
 void vm_thread_swapin(struct thread *td);
 void vm_thread_swapout(struct thread *td);
+
+void *contigmalloc2(vm_page_t m, vm_pindex_t npages, int flags);
 #endif				/* _KERNEL */
 #endif				/* !_VM_EXTERN_H_ */


More information about the p4-projects mailing list