diff options
author | alc <alc@FreeBSD.org> | 2009-04-04 23:12:14 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2009-04-04 23:12:14 +0000 |
commit | 85b0c58343338196160a3f3214cb1d10af9e5182 (patch) | |
tree | 096a8c4dae121c5d60e8cd039a81c8243558098f | |
parent | 43f12bcbe6cd236c43a2796a77aca22e701d5f22 (diff) | |
download | FreeBSD-src-85b0c58343338196160a3f3214cb1d10af9e5182.zip FreeBSD-src-85b0c58343338196160a3f3214cb1d10af9e5182.tar.gz |
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.
-rw-r--r-- | sys/arm/include/vmparam.h | 2 | ||||
-rw-r--r-- | sys/i386/include/vmparam.h | 4 | ||||
-rw-r--r-- | sys/vm/vm_mmap.c | 12 |
3 files changed, 0 insertions, 18 deletions
diff --git a/sys/arm/include/vmparam.h b/sys/arm/include/vmparam.h index bc82fd0..d54671d 100644 --- a/sys/arm/include/vmparam.h +++ b/sys/arm/include/vmparam.h @@ -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 */ diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h index f114232..e5f596c 100644 --- a/sys/i386/include/vmparam.h +++ b/sys/i386/include/vmparam.h @@ -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 */ diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 2d668c4..6cc0acc 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -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, vm_size_t size, vm_prot_t prot, 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); |