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 /sys/vm | |
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.
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_mmap.c | 12 |
1 files changed, 0 insertions, 12 deletions
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); |