svn commit: r353014 - head/sys/kern

Mark Johnston markj at FreeBSD.org
Wed Oct 2 16:34:43 UTC 2019


Author: markj
Date: Wed Oct  2 16:34:42 2019
New Revision: 353014
URL: https://svnweb.freebsd.org/changeset/base/353014

Log:
  Use OBJT_PHYS VM objects for kernel modules.
  
  OBJT_DEFAULT incurs some unnecessary overhead given that kernel module
  pages cannot be paged out.
  
  Reviewed by:	alc, kib
  MFC after:	1 week
  Sponsored by:	Netflix
  Differential Revision:	https://reviews.freebsd.org/D21862

Modified:
  head/sys/kern/link_elf.c
  head/sys/kern/link_elf_obj.c

Modified: head/sys/kern/link_elf.c
==============================================================================
--- head/sys/kern/link_elf.c	Wed Oct  2 16:18:50 2019	(r353013)
+++ head/sys/kern/link_elf.c	Wed Oct  2 16:34:42 2019	(r353014)
@@ -991,7 +991,7 @@ link_elf_load_file(linker_class_t cls, const char* fil
 
 	ef = (elf_file_t) lf;
 #ifdef SPARSE_MAPPING
-	ef->object = vm_object_allocate(OBJT_DEFAULT, mapsize >> PAGE_SHIFT);
+	ef->object = vm_object_allocate(OBJT_PHYS, atop(mapsize));
 	if (ef->object == NULL) {
 		error = ENOMEM;
 		goto out;

Modified: head/sys/kern/link_elf_obj.c
==============================================================================
--- head/sys/kern/link_elf_obj.c	Wed Oct  2 16:18:50 2019	(r353013)
+++ head/sys/kern/link_elf_obj.c	Wed Oct  2 16:34:42 2019	(r353014)
@@ -774,8 +774,7 @@ link_elf_load_file(linker_class_t cls, const char *fil
 	 * This stuff needs to be in a single chunk so that profiling etc
 	 * can get the bounds and gdb can associate offsets with modules
 	 */
-	ef->object = vm_object_allocate(OBJT_DEFAULT,
-	    round_page(mapsize) >> PAGE_SHIFT);
+	ef->object = vm_object_allocate(OBJT_PHYS, atop(round_page(mapsize)));
 	if (ef->object == NULL) {
 		error = ENOMEM;
 		goto out;


More information about the svn-src-head mailing list