svn commit: r190705 - in head/sys: arm/include i386/include vm

Alan Cox alc at FreeBSD.org
Sat Apr 4 16:12:15 PDT 2009


Author: alc
Date: Sat Apr  4 23:12:14 2009
New Revision: 190705
URL: http://svn.freebsd.org/changeset/base/190705

Log:
  Retire VM_PROT_READ_IS_EXEC.  It was intended to be a micro-optimization,
  but I see no benefit from it today.
  
  VM_PROT_READ_IS_EXEC was only intended for use on processors that do not
  distinguish between read and execute permission.  On an mmap(2) or
  mprotect(2), it automatically added execute permission if the caller
  specified permissions included read permission.  The hope was that this
  would reduce the number of vm map entries needed to implement an address
  space because there would be fewer neighboring vm map entries that differed
  only in the presence or absence of VM_PROT_EXECUTE.  (See vm/vm_mmap.c
  revision 1.56.)
  
  Today, I don't see any real applications that benefit from
  VM_PROT_READ_IS_EXEC.  In any case, vm map entries are now organized
  as a self-adjusting binary search tree instead of an ordered list.  So,
  the need for coalescing vm map entries is not as great as it once was.

Modified:
  head/sys/arm/include/vmparam.h
  head/sys/i386/include/vmparam.h
  head/sys/vm/vm_mmap.c

Modified: head/sys/arm/include/vmparam.h
==============================================================================
--- head/sys/arm/include/vmparam.h	Sat Apr  4 22:23:03 2009	(r190704)
+++ head/sys/arm/include/vmparam.h	Sat Apr  4 23:12:14 2009	(r190705)
@@ -141,8 +141,6 @@
 #define SGROWSIZ        (128*1024)
 #define MAXSLP		20
 
-#define VM_PROT_READ_IS_EXEC
-
 #ifdef ARM_USE_SMALL_ALLOC
 #define UMA_MD_SMALL_ALLOC
 #endif /* ARM_USE_SMALL_ALLOC */

Modified: head/sys/i386/include/vmparam.h
==============================================================================
--- head/sys/i386/include/vmparam.h	Sat Apr  4 22:23:03 2009	(r190704)
+++ head/sys/i386/include/vmparam.h	Sat Apr  4 23:12:14 2009	(r190705)
@@ -43,10 +43,6 @@
  * Machine dependent constants for 386.
  */
 
-#ifndef PAE
-#define VM_PROT_READ_IS_EXEC	/* if you can read -- then you can exec */
-#endif
-
 /*
  * Virtual memory related constants, all in bytes
  */

Modified: head/sys/vm/vm_mmap.c
==============================================================================
--- head/sys/vm/vm_mmap.c	Sat Apr  4 22:23:03 2009	(r190704)
+++ head/sys/vm/vm_mmap.c	Sat Apr  4 23:12:14 2009	(r190705)
@@ -620,10 +620,6 @@ mprotect(td, uap)
 	addr = (vm_offset_t) uap->addr;
 	size = uap->len;
 	prot = uap->prot & VM_PROT_ALL;
-#if defined(VM_PROT_READ_IS_EXEC)
-	if (prot & VM_PROT_READ)
-		prot |= VM_PROT_EXECUTE;
-#endif
 
 	pageoff = (addr & PAGE_MASK);
 	addr -= pageoff;
@@ -1441,14 +1437,6 @@ vm_mmap(vm_map_t map, vm_offset_t *addr,
 	if (flags & MAP_NOCORE)
 		docow |= MAP_DISABLE_COREDUMP;
 
-#if defined(VM_PROT_READ_IS_EXEC)
-	if (prot & VM_PROT_READ)
-		prot |= VM_PROT_EXECUTE;
-
-	if (maxprot & VM_PROT_READ)
-		maxprot |= VM_PROT_EXECUTE;
-#endif
-
 	if (flags & MAP_STACK)
 		rv = vm_map_stack(map, *addr, size, prot, maxprot,
 		    docow | MAP_STACK_GROWS_DOWN);


More information about the svn-src-all mailing list