#
555b9ff7 |
|
24-Jun-2023 |
Niels Sascha Reedijk <niels.reedijk@gmail.com> |
agp_gart: initialize member before using it. GCC 13 warns that this member could be unitialized. Now it is initialized explicitly before it is used anywhere else. Change-Id: Ia8d5e95cc247921c6ee240a106a80d73c54caee4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6652 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
956f4507 |
|
22-May-2022 |
Trung Nguyen <trungnt282910@gmail.com> |
kernel/vm: Remove default kernel read/write flags `fix_protection` will not apply `B_KERNEL_READ_AREA` and `B_KERNEL_WRITE_AREA` by default. Kernel drivers that directly call `create_area` or `create_area_etc` and do not pass any protection flags have been updated to apply `B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA` instead. Bug: #17751 Change-Id: I43e7ee6b5396e0309cdcff750e28262942c6d01c Reviewed-on: https://review.haiku-os.org/c/haiku/+/5330 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
12d046d0 |
|
16-Jul-2019 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
PVS V547: always false conditions Change-Id: I389c081331b1c5ef67bef9ffcac9055573e1ebf5 Reviewed-on: https://review.haiku-os.org/c/1605 Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
|
#
21c87a5d |
|
09-Sep-2018 |
Jérôme Duval <jerome.duval@gmail.com> |
drivers: remove some non-haiku support code. Change-Id: Ic55bb4832adabeb807f763c87ad938e74fb3a97d Reviewed-on: https://review.haiku-os.org/520 Reviewed-by: Axel Dörfler <axeld@pinc-software.de> Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
7d5632a0 |
|
06-Sep-2013 |
Jérôme Duval <jerome.duval@gmail.com> |
agp_gart: added message logs on errors.
|
#
82c2deb5 |
|
04-May-2013 |
Jérôme Duval <jerome.duval@gmail.com> |
agp_gart: some 64 bit fixes
|
#
e373834f |
|
29-Sep-2011 |
Axel Dörfler <axeld@pinc-software.de> |
* Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42783 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c53724f7 |
|
21-Jun-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added work-arounds for intel_gart not being able to deal with physical addresses > 4 GB. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37210 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a8ad734f |
|
14-Jun-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduced structures {virtual,physical}_address_restrictions, which specify restrictions for virtual/physical addresses. * vm_page_allocate_page_run(): - Fixed conversion of base/limit to array indexes. sPhysicalPageOffset was not taken into account. - Takes a physical_address_restrictions instead of base/limit and also supports alignment and boundary restrictions, now. * map_backing_store(), VM[User,Kernel]AddressSpace::InsertArea()/ ReserveAddressRange() take a virtual_address_restrictions parameter, now. They also support an alignment independent from the range size. * create_area_etc(), vm_create_anonymous_area(): Take {virtual,physical}_address_restrictions parameters, now. * Removed no longer needed B_PHYSICAL_BASE_ADDRESS. * DMAResources: - Fixed potential overflows of uint32 when initializing from device node attributes. - Fixed bounce buffer creation TODOs: By using create_area_etc() with the new restrictions parameters we can directly support physical high address, boundary, and alignment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37131 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1d26c724 |
|
10-Jun-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
vm_page_allocate_page_run(): Added parameter "limit", specifying the upper physical address limit for the page run to allocate. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37086 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
9a063f05 |
|
28-May-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Fixed the AGP interface to correctly use phys_addr_t where needed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36962 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
64d79eff |
|
27-May-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Changed physical_entry::{address,size} to phys_{addr,size}_t and changed map_physical_memory()'s physicalAddress parameter type from void* to phys_addr_t. This breaks source compatibility, but -- as long as phys_{addr,size}_t remain 32 bit wide -- keeps binary compatibility with BeOS. * Adjusted all code using the affected interfaces (Oh what fun!). Added a few TODOs in places where the wrong types (e.g. void* for physical addresses are used). Looks like quite a few drivers aren't 64 bit safe and others will break with PAE. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36960 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
40bb9481 |
|
03-Feb-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Removed useless return parameter from vm_remove_all_page_mappings(). * Added vm_clear_page_mapping_accessed_flags() and vm_remove_all_page_mappings_if_unaccessed(), which combine the functionality of vm_test_map_activation(), vm_clear_map_flags(), and vm_remove_all_page_mappings(), thus saving lots of calls to translation map methods. The backend is the new method VMTranslationMap::ClearAccessedAndModified(). * Started to make use of the cached page queue and changed the meaning of the other non-free queues slightly: - Active queue: Contains mapped pages that have been used recently. - Inactive queue: Contains mapped pages that have not been used recently. Also contains unmapped temporary pages. - Modified queue: Contains unmapped modified pages. - Cached queue: Contains unmapped unmodified pages (LRU sorted). Unless we're actually low on memory and actively do paging, modified and cached queues only contain non-temporary pages. Cached pages are considered quasi free. They still belong to a cache, but since they are unmodified and unmapped, they can be freed immediately. And this is what vm_page_[try_]reserve_pages() do now when there are no more actually free pages at hand. Essentially this means that pages storing cached file data, unless mmap()ped, no longer are considered used and don't contribute to page pressure. Paging will not happen as long there are enough free + cached pages available. * Reimplemented the page daemon. It no longer scans all pages, but instead works the page queues. As long as the free pages situation is harmless, it only iterates through the active queue and deactivates pages that have not been used recently. When paging occurs it additionally scans the inactive queue and frees pages that have not been used recently. * Changed the page reservation/allocation interface: vm_page_[try_]reserve_pages(), vm_page_unreserve_pages(), and vm_page_allocate_page() now take a vm_page_reservation structure pointer. The reservation functions initialize the structure -- currently consisting only of a count member for the number of still reserved pages. vm_page_allocate_page() decrements the count and vm_page_unreserve_pages() unreserves the remaining pages (if any). Advantages are that reservation/ unreservation mismatches cannot occur anymore, that vm_page_allocate_page() can verify that the caller has indeed a reserved page left, and that there's no unnecessary pressure on the free page pool anymore. The only disadvantage is that the vm_page_reservation object needs to be passed around a bit. * Reworked the page reservation implementation: - Got rid of sSystemReservedPages and sPageDeficit. Instead sUnreservedFreePages now actually contains the number of free pages that have not yet been reserved (it cannot become negative anymore) and the new sUnsatisfiedPageReservations contains the number of pages that are still needed for reservation. - Threads waiting for reservations do now add themselves to a waiter queue, which is ordered by descending priority (VM priority and thread priority). High priority waiters are served first when pages become available. Fixes #5328. * cache_prefetch_vnode(): Would reserve one less page than allocated later, if the size wasn't page aligned. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35393 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e65c4002 |
|
29-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Replaced the vm_page_allocate_page*() "pageState" parameter by a more general "flags" parameter. It encodes the target state of the page -- so that the page isn't unnecessarily put in the wrong page queue first -- a flag whether the page should be cleared, and one to indicate whether the page should be marked busy. * Added page state PAGE_STATE_CACHED. Not used yet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35333 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
72382fa6 |
|
29-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Removed the page state PAGE_STATE_BUSY and instead introduced a vm_page::busy flag. The obvious advantage is that one can still see what state a page is in and even move it between states while being marked busy. * Removed the vm_page::is_dummy flag. Instead we mark marker pages busy, which in all cases has the same effect. Introduced a vm_page_is_dummy() that can still check whether a given page is a dummy page. * vm_page_unreserve_pages(): Before adding to the system reserve make sure sUnreservedFreePages is non-negative. Otherwise we'd make nonexisting pages available for allocation. steal_pages() still has the same problem and it can't be solved that easily. * map_page(): No longer changes the page state/mark the page unbusy. That's the caller's responsibility. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35331 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
cff6e9e4 |
|
26-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* The system now holds back a small reserve of committable memory and pages. The memory and page reservation functions have a new "priority" parameter that indicates how deep the function may tap into that reserve. The currently existing priority levels are "user", "system", and "VIP". The idea is that user programs should never be able to cause a state that gets the kernel into trouble due to heavy battling for memory. The "VIP" level (not really used yet) is intended for allocations that are required to free memory eventually (in the page writer). More levels are thinkable in the future, like "user real time" or "user system server". * Added "priority" parameters to several VMCache methods. * Replaced the map_backing_store() "unmapAddressRange" parameter by a "flags" parameter. * Added area creation flag CREATE_AREA_PRIORITY_VIP and slab allocator flag CACHE_PRIORITY_VIP indicating the importance of the request. * Changed most code to pass the right priorities/flags. These changes already significantly improve the behavior in low memory situations. I've tested a bit with 64 MB (virtual) RAM and, while not particularly fast and responsive, the system remains at least usable under high memory pressure. As a side effect the slab allocator can now be used as general memory allocator. Not done by default yet, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35295 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
3cd20943 |
|
06-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added new debug feature (DEBUG_PAGE_ACCESS) to detect invalid concurrent access to a vm_page. It is basically an atomically accessed thread ID field in the vm_page structure, which is explicitly set by macros marking the critical sections. As a first positive effect I had to review quite a bit of code and found several issues. * Added several TODOs and comments. Some harmless ones, but also a few troublesome ones in vm.cpp regarding page unmapping. * file_cache: PrecacheIO::Prepare()/read_into_cache: Removed superfluous vm_page_allocate_page() return value checks. It cannot fail anymore. * Removed the heavily contended "pages" lock. We use different policies now: - sModifiedTemporaryPages is accessed atomically. - sPageDeficitLock and sFreePageCondition are protected by a new mutex. - The page queues have individual locks (mutexes). - Renamed set_page_state_nolock() to set_page_state(). Unless the caller says otherwise, it does now lock the affected pages queues itself. Also changed the return value to void -- we panic() anyway. * set_page_state(): Add free/clear pages to the beginning of their respective queues as this is more cache-friendly. * Pages with the states PAGE_STATE_WIRED or PAGE_STATE_UNUSED are no longer in any queue. They were in the "active" queue, but there's no good reason to have them there. In case we decide to let the page daemon work the queues (like FreeBSD) they would just be in the way. * Pulled the common part of vm_page_allocate_page_run[_no_base]() into a helper function. Also fixed a bug I introduced previously: The functions must not vm_page_unreserve_pages() on success, since they remove the pages from the free/clear queue without decrementing sUnreservedFreePages. * vm_page_set_state(): Changed return type to void. The function cannot really fail and no-one was checking it anyway. * vm_page_free(), vm_page_set_state(): Added assertion: The page must not be free/clear before. This is implied by the policy that no-one is allowed to access free/clear pages without holding the respective queue's lock, which is not the case at this point. This found the bug fixed in r34912. * vm_page_requeue(): Added general assertions. panic() when requeuing of free/clear pages is requested. Same reason as above. * vm_clone_area(), B_FULL_LOCK case: Don't map busy pages. The implementation is still not correct, though. My usual -j8 Haiku build test runs another 10% faster, now. The total kernel time drops about 18%. As hoped the new locks have only a fraction of the old "pages" lock contention. Other locks lead the "most wanted list" now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34933 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1021fd28 |
|
01-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* agp_gart(): Use vm_page_[un]reserve_pages(). * Removed unused vm_page_allocate_pages(). * Removed now unused (always true) "reserved" parameter from vm_page_allocate_page(). * Removed unused (always false) "stealActive" parameter from steal_page(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34836 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e50cf876 |
|
02-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved the VM headers into subdirectory vm/. * Renamed vm_cache.h/vm_address_space.h to VMCache.h/VMAddressSpace. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34449 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8f10aa5d |
|
15-Oct-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Fixed warning, the ROUNDUP macro is already defined. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33595 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5147963d |
|
26-Jul-2009 |
Stephan Aßmus <superstippi@gmx.de> |
headers/private/kernel/util/OpenHashTable.h, Hugo's version, is a bit nicer than Tracker's OpenHashTable.h which it should eventually replace. We've renamed the class to BOpenHashTable and changed the interface slightly so that HashTableLink became superfluous. Adapted all the code that used it. Since the OpenHashTables no longer clash, this should fix the GCC4 build. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31791 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7f5c5dc8 |
|
09-Apr-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Don't try to free the pages area when all you had was a single page (in the union). * This fixes a crash on restart that has been revealed by Oco's change to the reboot process. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30085 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f97fa70d |
|
16-Jul-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Build fix: the AGP-GART bus manager also used vm_page_allocate_page_run(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26460 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ed7d0f52 |
|
17-Feb-2008 |
Axel Dörfler <axeld@pinc-software.de> |
Added a bit more debug output. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23999 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f033aee1 |
|
01-Feb-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Added B_NOT_SUPPORTED, B_KERNEL_READ_AREA, and B_KERNEL_WRITE_AREA to HaikuBuildCompatibility.h; this fixes building agp_gart and the intel extreme driver for BeOS. * Added sockaddr_storage to HaikuBuildCompatibility.h. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23823 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0148fb2d |
|
31-Jan-2008 |
Axel Dörfler <axeld@pinc-software.de> |
Accidently didn't use reference but an ordinary variable - thanks to Marcus for reading my commit and noticing! :-) Using the test application I could have found that bug; that codepath is currently not used in Haiku. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23801 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
d23e60e7 |
|
31-Jan-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Forgot to set the size in Aperture::BindMemory() in case it was allocated memory (so no memory was ever bound in that case). * Disabled debug output in the Intel GART module. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23797 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
103d05f3 |
|
31-Jan-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Renamed GART's deallocate_memory() to free_memory(). * Removed "physical" parameter of GART's bind_aperture() - I don't think this be of use to anyone. * Fixed binding/unbinding pages in the Intel GART driver; I accidently shifted the page offset twice. * Actually forgot handling of allocated memory in Aperture::BindMemory(). * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23796 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7e6d2343 |
|
28-Jan-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Refactored _AdaptToReserved() out of Aperture::AllocateMemory(), as it's now also used in BindMemory() and UnbindMemory() - before the latter two were just not working correctly for memory in the reserved region. * The Aperture destructor now also frees (and unbinds) all still existing allocations. * Aperture::fFirstMemory was not initialized. * Added some more debug output. * BindMemory()'s vertical to physical address translation didn't work correctly. * alignment must be at least B_PAGE_SIZE in _Insert(). * bind_aperture() needs to pass the B_APERTURE_NON_RESERVED flag to CreateMemory(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23774 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
481c8841 |
|
28-Jan-2008 |
Axel Dörfler <axeld@pinc-software.de> |
Renamed agp.cpp to agp_gart.cpp. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23771 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7d5632a0daaae2fda4a37e9492ff40a411f3cb06 |
|
06-Sep-2013 |
Jérôme Duval <jerome.duval@gmail.com> |
agp_gart: added message logs on errors.
|
#
82c2deb5b76c5715f74fcb35aea4ceb2c5a77336 |
|
04-May-2013 |
Jérôme Duval <jerome.duval@gmail.com> |
agp_gart: some 64 bit fixes
|
#
e373834fe9cdaac94af7bf207c19ed32b381b2e2 |
|
29-Sep-2011 |
Axel Dörfler <axeld@pinc-software.de> |
* Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42783 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c53724f7bfe8e71aae29ec4ea44a1b715c8de957 |
|
21-Jun-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added work-arounds for intel_gart not being able to deal with physical addresses > 4 GB. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37210 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a8ad734f1c698917badb15e1641e0f38b3e9a013 |
|
14-Jun-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduced structures {virtual,physical}_address_restrictions, which specify restrictions for virtual/physical addresses. * vm_page_allocate_page_run(): - Fixed conversion of base/limit to array indexes. sPhysicalPageOffset was not taken into account. - Takes a physical_address_restrictions instead of base/limit and also supports alignment and boundary restrictions, now. * map_backing_store(), VM[User,Kernel]AddressSpace::InsertArea()/ ReserveAddressRange() take a virtual_address_restrictions parameter, now. They also support an alignment independent from the range size. * create_area_etc(), vm_create_anonymous_area(): Take {virtual,physical}_address_restrictions parameters, now. * Removed no longer needed B_PHYSICAL_BASE_ADDRESS. * DMAResources: - Fixed potential overflows of uint32 when initializing from device node attributes. - Fixed bounce buffer creation TODOs: By using create_area_etc() with the new restrictions parameters we can directly support physical high address, boundary, and alignment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37131 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1d26c7248fcd916adadc03b5fd59cfc4f2adfaa5 |
|
10-Jun-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
vm_page_allocate_page_run(): Added parameter "limit", specifying the upper physical address limit for the page run to allocate. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37086 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
9a063f059c37536b1d0a6b38a173c9aa0cd6f854 |
|
28-May-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Fixed the AGP interface to correctly use phys_addr_t where needed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36962 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
64d79eff7290437d24b1a420537c3ed5c144ab96 |
|
27-May-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Changed physical_entry::{address,size} to phys_{addr,size}_t and changed map_physical_memory()'s physicalAddress parameter type from void* to phys_addr_t. This breaks source compatibility, but -- as long as phys_{addr,size}_t remain 32 bit wide -- keeps binary compatibility with BeOS. * Adjusted all code using the affected interfaces (Oh what fun!). Added a few TODOs in places where the wrong types (e.g. void* for physical addresses are used). Looks like quite a few drivers aren't 64 bit safe and others will break with PAE. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36960 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
40bb94819e6c39d72ab29edc1a0dcd80b15b8b42 |
|
03-Feb-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Removed useless return parameter from vm_remove_all_page_mappings(). * Added vm_clear_page_mapping_accessed_flags() and vm_remove_all_page_mappings_if_unaccessed(), which combine the functionality of vm_test_map_activation(), vm_clear_map_flags(), and vm_remove_all_page_mappings(), thus saving lots of calls to translation map methods. The backend is the new method VMTranslationMap::ClearAccessedAndModified(). * Started to make use of the cached page queue and changed the meaning of the other non-free queues slightly: - Active queue: Contains mapped pages that have been used recently. - Inactive queue: Contains mapped pages that have not been used recently. Also contains unmapped temporary pages. - Modified queue: Contains unmapped modified pages. - Cached queue: Contains unmapped unmodified pages (LRU sorted). Unless we're actually low on memory and actively do paging, modified and cached queues only contain non-temporary pages. Cached pages are considered quasi free. They still belong to a cache, but since they are unmodified and unmapped, they can be freed immediately. And this is what vm_page_[try_]reserve_pages() do now when there are no more actually free pages at hand. Essentially this means that pages storing cached file data, unless mmap()ped, no longer are considered used and don't contribute to page pressure. Paging will not happen as long there are enough free + cached pages available. * Reimplemented the page daemon. It no longer scans all pages, but instead works the page queues. As long as the free pages situation is harmless, it only iterates through the active queue and deactivates pages that have not been used recently. When paging occurs it additionally scans the inactive queue and frees pages that have not been used recently. * Changed the page reservation/allocation interface: vm_page_[try_]reserve_pages(), vm_page_unreserve_pages(), and vm_page_allocate_page() now take a vm_page_reservation structure pointer. The reservation functions initialize the structure -- currently consisting only of a count member for the number of still reserved pages. vm_page_allocate_page() decrements the count and vm_page_unreserve_pages() unreserves the remaining pages (if any). Advantages are that reservation/ unreservation mismatches cannot occur anymore, that vm_page_allocate_page() can verify that the caller has indeed a reserved page left, and that there's no unnecessary pressure on the free page pool anymore. The only disadvantage is that the vm_page_reservation object needs to be passed around a bit. * Reworked the page reservation implementation: - Got rid of sSystemReservedPages and sPageDeficit. Instead sUnreservedFreePages now actually contains the number of free pages that have not yet been reserved (it cannot become negative anymore) and the new sUnsatisfiedPageReservations contains the number of pages that are still needed for reservation. - Threads waiting for reservations do now add themselves to a waiter queue, which is ordered by descending priority (VM priority and thread priority). High priority waiters are served first when pages become available. Fixes #5328. * cache_prefetch_vnode(): Would reserve one less page than allocated later, if the size wasn't page aligned. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35393 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e65c400299386f99a251395ff2e59572705d7e49 |
|
29-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Replaced the vm_page_allocate_page*() "pageState" parameter by a more general "flags" parameter. It encodes the target state of the page -- so that the page isn't unnecessarily put in the wrong page queue first -- a flag whether the page should be cleared, and one to indicate whether the page should be marked busy. * Added page state PAGE_STATE_CACHED. Not used yet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35333 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
72382fa6291e810be2949a70abd8f274f92dbd2c |
|
29-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Removed the page state PAGE_STATE_BUSY and instead introduced a vm_page::busy flag. The obvious advantage is that one can still see what state a page is in and even move it between states while being marked busy. * Removed the vm_page::is_dummy flag. Instead we mark marker pages busy, which in all cases has the same effect. Introduced a vm_page_is_dummy() that can still check whether a given page is a dummy page. * vm_page_unreserve_pages(): Before adding to the system reserve make sure sUnreservedFreePages is non-negative. Otherwise we'd make nonexisting pages available for allocation. steal_pages() still has the same problem and it can't be solved that easily. * map_page(): No longer changes the page state/mark the page unbusy. That's the caller's responsibility. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35331 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
cff6e9e406132a76bfc20cb35ff5228dd0ba94d8 |
|
26-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* The system now holds back a small reserve of committable memory and pages. The memory and page reservation functions have a new "priority" parameter that indicates how deep the function may tap into that reserve. The currently existing priority levels are "user", "system", and "VIP". The idea is that user programs should never be able to cause a state that gets the kernel into trouble due to heavy battling for memory. The "VIP" level (not really used yet) is intended for allocations that are required to free memory eventually (in the page writer). More levels are thinkable in the future, like "user real time" or "user system server". * Added "priority" parameters to several VMCache methods. * Replaced the map_backing_store() "unmapAddressRange" parameter by a "flags" parameter. * Added area creation flag CREATE_AREA_PRIORITY_VIP and slab allocator flag CACHE_PRIORITY_VIP indicating the importance of the request. * Changed most code to pass the right priorities/flags. These changes already significantly improve the behavior in low memory situations. I've tested a bit with 64 MB (virtual) RAM and, while not particularly fast and responsive, the system remains at least usable under high memory pressure. As a side effect the slab allocator can now be used as general memory allocator. Not done by default yet, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35295 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
3cd2094396dde9ca42263c535041a95d5f0d5fff |
|
06-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added new debug feature (DEBUG_PAGE_ACCESS) to detect invalid concurrent access to a vm_page. It is basically an atomically accessed thread ID field in the vm_page structure, which is explicitly set by macros marking the critical sections. As a first positive effect I had to review quite a bit of code and found several issues. * Added several TODOs and comments. Some harmless ones, but also a few troublesome ones in vm.cpp regarding page unmapping. * file_cache: PrecacheIO::Prepare()/read_into_cache: Removed superfluous vm_page_allocate_page() return value checks. It cannot fail anymore. * Removed the heavily contended "pages" lock. We use different policies now: - sModifiedTemporaryPages is accessed atomically. - sPageDeficitLock and sFreePageCondition are protected by a new mutex. - The page queues have individual locks (mutexes). - Renamed set_page_state_nolock() to set_page_state(). Unless the caller says otherwise, it does now lock the affected pages queues itself. Also changed the return value to void -- we panic() anyway. * set_page_state(): Add free/clear pages to the beginning of their respective queues as this is more cache-friendly. * Pages with the states PAGE_STATE_WIRED or PAGE_STATE_UNUSED are no longer in any queue. They were in the "active" queue, but there's no good reason to have them there. In case we decide to let the page daemon work the queues (like FreeBSD) they would just be in the way. * Pulled the common part of vm_page_allocate_page_run[_no_base]() into a helper function. Also fixed a bug I introduced previously: The functions must not vm_page_unreserve_pages() on success, since they remove the pages from the free/clear queue without decrementing sUnreservedFreePages. * vm_page_set_state(): Changed return type to void. The function cannot really fail and no-one was checking it anyway. * vm_page_free(), vm_page_set_state(): Added assertion: The page must not be free/clear before. This is implied by the policy that no-one is allowed to access free/clear pages without holding the respective queue's lock, which is not the case at this point. This found the bug fixed in r34912. * vm_page_requeue(): Added general assertions. panic() when requeuing of free/clear pages is requested. Same reason as above. * vm_clone_area(), B_FULL_LOCK case: Don't map busy pages. The implementation is still not correct, though. My usual -j8 Haiku build test runs another 10% faster, now. The total kernel time drops about 18%. As hoped the new locks have only a fraction of the old "pages" lock contention. Other locks lead the "most wanted list" now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34933 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1021fd28262697dbbbe1d54a868f0672900c78f3 |
|
01-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* agp_gart(): Use vm_page_[un]reserve_pages(). * Removed unused vm_page_allocate_pages(). * Removed now unused (always true) "reserved" parameter from vm_page_allocate_page(). * Removed unused (always false) "stealActive" parameter from steal_page(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34836 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e50cf8765be50a7454c9488db38b638cf90805af |
|
02-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved the VM headers into subdirectory vm/. * Renamed vm_cache.h/vm_address_space.h to VMCache.h/VMAddressSpace. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34449 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8f10aa5da6697a40261794f31160e4603da21272 |
|
15-Oct-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Fixed warning, the ROUNDUP macro is already defined. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33595 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5147963dcd57fefa4f63c484eb88e9eaf4002976 |
|
26-Jul-2009 |
Stephan Aßmus <superstippi@gmx.de> |
headers/private/kernel/util/OpenHashTable.h, Hugo's version, is a bit nicer than Tracker's OpenHashTable.h which it should eventually replace. We've renamed the class to BOpenHashTable and changed the interface slightly so that HashTableLink became superfluous. Adapted all the code that used it. Since the OpenHashTables no longer clash, this should fix the GCC4 build. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31791 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7f5c5dc8a11692c28add21d66ca9efd21bcfc993 |
|
09-Apr-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Don't try to free the pages area when all you had was a single page (in the union). * This fixes a crash on restart that has been revealed by Oco's change to the reboot process. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30085 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f97fa70dfbb253ccd8c674cb1be18172ae35c1e4 |
|
16-Jul-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Build fix: the AGP-GART bus manager also used vm_page_allocate_page_run(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26460 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ed7d0f52bfc58208f371a9d50a0961ad42c512db |
|
17-Feb-2008 |
Axel Dörfler <axeld@pinc-software.de> |
Added a bit more debug output. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23999 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f033aee165755571c178876ee518ef6ac311960c |
|
01-Feb-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Added B_NOT_SUPPORTED, B_KERNEL_READ_AREA, and B_KERNEL_WRITE_AREA to HaikuBuildCompatibility.h; this fixes building agp_gart and the intel extreme driver for BeOS. * Added sockaddr_storage to HaikuBuildCompatibility.h. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23823 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0148fb2dbc4236aad2ca0f823f6e802228bffd62 |
|
31-Jan-2008 |
Axel Dörfler <axeld@pinc-software.de> |
Accidently didn't use reference but an ordinary variable - thanks to Marcus for reading my commit and noticing! :-) Using the test application I could have found that bug; that codepath is currently not used in Haiku. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23801 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
d23e60e77b496b1a98e615ca3bfbc2007da8b841 |
|
31-Jan-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Forgot to set the size in Aperture::BindMemory() in case it was allocated memory (so no memory was ever bound in that case). * Disabled debug output in the Intel GART module. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23797 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
103d05f3c2db9203f8de61e744c99acc2be41141 |
|
31-Jan-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Renamed GART's deallocate_memory() to free_memory(). * Removed "physical" parameter of GART's bind_aperture() - I don't think this be of use to anyone. * Fixed binding/unbinding pages in the Intel GART driver; I accidently shifted the page offset twice. * Actually forgot handling of allocated memory in Aperture::BindMemory(). * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23796 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7e6d23431c76da9dfe3c30ed746c27a2fcc0ae10 |
|
28-Jan-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Refactored _AdaptToReserved() out of Aperture::AllocateMemory(), as it's now also used in BindMemory() and UnbindMemory() - before the latter two were just not working correctly for memory in the reserved region. * The Aperture destructor now also frees (and unbinds) all still existing allocations. * Aperture::fFirstMemory was not initialized. * Added some more debug output. * BindMemory()'s vertical to physical address translation didn't work correctly. * alignment must be at least B_PAGE_SIZE in _Insert(). * bind_aperture() needs to pass the B_APERTURE_NON_RESERVED flag to CreateMemory(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23774 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
481c8841642ea245323ffe73894974a5690ce945 |
|
28-Jan-2008 |
Axel Dörfler <axeld@pinc-software.de> |
Renamed agp.cpp to agp_gart.cpp. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23771 a95241bf-73f2-0310-859d-f6bbb57e9c96
|