vm_map.c (129018) | vm_map.c (129571) |
---|---|
1/* 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 49 unchanged lines hidden (view full) --- 58 * rights to redistribute these changes. 59 */ 60 61/* 62 * Virtual memory mapping module. 63 */ 64 65#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 49 unchanged lines hidden (view full) --- 58 * rights to redistribute these changes. 59 */ 60 61/* 62 * Virtual memory mapping module. 63 */ 64 65#include <sys/cdefs.h> |
66__FBSDID("$FreeBSD: head/sys/vm/vm_map.c 129018 2004-05-07 00:17:07Z green $"); | 66__FBSDID("$FreeBSD: head/sys/vm/vm_map.c 129571 2004-05-22 04:53:51Z alc $"); |
67 68#include <sys/param.h> 69#include <sys/systm.h> 70#include <sys/ktr.h> 71#include <sys/lock.h> 72#include <sys/mutex.h> 73#include <sys/proc.h> 74#include <sys/vmmeter.h> --- 1646 unchanged lines hidden (view full) --- 1721 if (rv == KERN_SUCCESS) { 1722 if (user_unwire) 1723 entry->eflags &= ~MAP_ENTRY_USER_WIRED; 1724 entry->wired_count--; 1725 if (entry->wired_count == 0) { 1726 /* 1727 * Retain the map lock. 1728 */ | 67 68#include <sys/param.h> 69#include <sys/systm.h> 70#include <sys/ktr.h> 71#include <sys/lock.h> 72#include <sys/mutex.h> 73#include <sys/proc.h> 74#include <sys/vmmeter.h> --- 1646 unchanged lines hidden (view full) --- 1721 if (rv == KERN_SUCCESS) { 1722 if (user_unwire) 1723 entry->eflags &= ~MAP_ENTRY_USER_WIRED; 1724 entry->wired_count--; 1725 if (entry->wired_count == 0) { 1726 /* 1727 * Retain the map lock. 1728 */ |
1729 vm_fault_unwire(map, entry->start, entry->end); | 1729 vm_fault_unwire(map, entry->start, entry->end, 1730 entry->object.vm_object != NULL && 1731 entry->object.vm_object->type == OBJT_DEVICE); |
1730 } 1731 } 1732 KASSERT(entry->eflags & MAP_ENTRY_IN_TRANSITION, 1733 ("vm_map_unwire: in-transition flag missing")); 1734 entry->eflags &= ~MAP_ENTRY_IN_TRANSITION; 1735 if (entry->eflags & MAP_ENTRY_NEEDS_WAKEUP) { 1736 entry->eflags &= ~MAP_ENTRY_NEEDS_WAKEUP; 1737 need_wakeup = TRUE; --- 15 unchanged lines hidden (view full) --- 1753int 1754vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, 1755 int flags) 1756{ 1757 vm_map_entry_t entry, first_entry, tmp_entry; 1758 vm_offset_t saved_end, saved_start; 1759 unsigned int last_timestamp; 1760 int rv; | 1732 } 1733 } 1734 KASSERT(entry->eflags & MAP_ENTRY_IN_TRANSITION, 1735 ("vm_map_unwire: in-transition flag missing")); 1736 entry->eflags &= ~MAP_ENTRY_IN_TRANSITION; 1737 if (entry->eflags & MAP_ENTRY_NEEDS_WAKEUP) { 1738 entry->eflags &= ~MAP_ENTRY_NEEDS_WAKEUP; 1739 need_wakeup = TRUE; --- 15 unchanged lines hidden (view full) --- 1755int 1756vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, 1757 int flags) 1758{ 1759 vm_map_entry_t entry, first_entry, tmp_entry; 1760 vm_offset_t saved_end, saved_start; 1761 unsigned int last_timestamp; 1762 int rv; |
1761 boolean_t need_wakeup, result, user_wire; | 1763 boolean_t fictitious, need_wakeup, result, user_wire; |
1762 1763 user_wire = (flags & VM_MAP_WIRE_USER) ? TRUE : FALSE; 1764 vm_map_lock(map); 1765 VM_MAP_RANGE_CHECK(map, start, end); 1766 if (!vm_map_lookup_entry(map, start, &first_entry)) { 1767 if (flags & VM_MAP_WIRE_HOLESOK) 1768 first_entry = first_entry->next; 1769 else { --- 59 unchanged lines hidden (view full) --- 1829 entry->eflags |= MAP_ENTRY_IN_TRANSITION; 1830 /* 1831 * 1832 */ 1833 if (entry->wired_count == 0) { 1834 entry->wired_count++; 1835 saved_start = entry->start; 1836 saved_end = entry->end; | 1764 1765 user_wire = (flags & VM_MAP_WIRE_USER) ? TRUE : FALSE; 1766 vm_map_lock(map); 1767 VM_MAP_RANGE_CHECK(map, start, end); 1768 if (!vm_map_lookup_entry(map, start, &first_entry)) { 1769 if (flags & VM_MAP_WIRE_HOLESOK) 1770 first_entry = first_entry->next; 1771 else { --- 59 unchanged lines hidden (view full) --- 1831 entry->eflags |= MAP_ENTRY_IN_TRANSITION; 1832 /* 1833 * 1834 */ 1835 if (entry->wired_count == 0) { 1836 entry->wired_count++; 1837 saved_start = entry->start; 1838 saved_end = entry->end; |
1839 fictitious = entry->object.vm_object != NULL && 1840 entry->object.vm_object->type == OBJT_DEVICE; |
|
1837 /* 1838 * Release the map lock, relying on the in-transition 1839 * mark. 1840 */ 1841 vm_map_unlock(map); 1842 rv = vm_fault_wire(map, saved_start, saved_end, | 1841 /* 1842 * Release the map lock, relying on the in-transition 1843 * mark. 1844 */ 1845 vm_map_unlock(map); 1846 rv = vm_fault_wire(map, saved_start, saved_end, |
1843 user_wire); | 1847 user_wire, fictitious); |
1844 vm_map_lock(map); 1845 if (last_timestamp + 1 != map->timestamp) { 1846 /* 1847 * Look again for the entry because the map was 1848 * modified while it was unlocked. The entry 1849 * may have been clipped, but NOT merged or 1850 * deleted. 1851 */ --- 67 unchanged lines hidden (view full) --- 1919 } else { 1920 if (!user_wire || 1921 (entry->eflags & MAP_ENTRY_USER_WIRED) == 0) 1922 entry->wired_count--; 1923 if (entry->wired_count == 0) { 1924 /* 1925 * Retain the map lock. 1926 */ | 1848 vm_map_lock(map); 1849 if (last_timestamp + 1 != map->timestamp) { 1850 /* 1851 * Look again for the entry because the map was 1852 * modified while it was unlocked. The entry 1853 * may have been clipped, but NOT merged or 1854 * deleted. 1855 */ --- 67 unchanged lines hidden (view full) --- 1923 } else { 1924 if (!user_wire || 1925 (entry->eflags & MAP_ENTRY_USER_WIRED) == 0) 1926 entry->wired_count--; 1927 if (entry->wired_count == 0) { 1928 /* 1929 * Retain the map lock. 1930 */ |
1927 vm_fault_unwire(map, entry->start, entry->end); | 1931 vm_fault_unwire(map, entry->start, entry->end, 1932 entry->object.vm_object != NULL && 1933 entry->object.vm_object->type == OBJT_DEVICE); |
1928 } 1929 } 1930 KASSERT(entry->eflags & MAP_ENTRY_IN_TRANSITION, 1931 ("vm_map_wire: in-transition flag missing")); 1932 entry->eflags &= ~MAP_ENTRY_IN_TRANSITION; 1933 if (entry->eflags & MAP_ENTRY_NEEDS_WAKEUP) { 1934 entry->eflags &= ~MAP_ENTRY_NEEDS_WAKEUP; 1935 need_wakeup = TRUE; --- 107 unchanged lines hidden (view full) --- 2043 * Make the region specified by this entry pageable. 2044 * 2045 * The map in question should be locked. 2046 * [This is the reason for this routine's existence.] 2047 */ 2048static void 2049vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry) 2050{ | 1934 } 1935 } 1936 KASSERT(entry->eflags & MAP_ENTRY_IN_TRANSITION, 1937 ("vm_map_wire: in-transition flag missing")); 1938 entry->eflags &= ~MAP_ENTRY_IN_TRANSITION; 1939 if (entry->eflags & MAP_ENTRY_NEEDS_WAKEUP) { 1940 entry->eflags &= ~MAP_ENTRY_NEEDS_WAKEUP; 1941 need_wakeup = TRUE; --- 107 unchanged lines hidden (view full) --- 2049 * Make the region specified by this entry pageable. 2050 * 2051 * The map in question should be locked. 2052 * [This is the reason for this routine's existence.] 2053 */ 2054static void 2055vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry) 2056{ |
2051 vm_fault_unwire(map, entry->start, entry->end); | 2057 vm_fault_unwire(map, entry->start, entry->end, 2058 entry->object.vm_object != NULL && 2059 entry->object.vm_object->type == OBJT_DEVICE); |
2052 entry->wired_count = 0; 2053} 2054 2055/* 2056 * vm_map_entry_delete: [ internal use only ] 2057 * 2058 * Deallocate the given entry from the target map. 2059 */ --- 1056 unchanged lines hidden --- | 2060 entry->wired_count = 0; 2061} 2062 2063/* 2064 * vm_map_entry_delete: [ internal use only ] 2065 * 2066 * Deallocate the given entry from the target map. 2067 */ --- 1056 unchanged lines hidden --- |