#
c25f6f53 |
|
29-Mar-2022 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel/vm: Completely replace mlock() implementation. The old implementation used the real lock_memory(). This is problematic and does not work for a large number of reasons: 1) Various parts of the kernel assume memory is locked only very temporarily, and will often wait on locked memory to become unlocked. The transient nature of locks is further demonstrated by the fact that lock_memory acquires references to structures, like the address space, which are only released by unlock_memory 2) The VM has a hard assumption that all lock_memory calls will be exactly balanced, and maintains internal "WiredRange" structures on areas, etc. corresponding to the original lock_memory calls. Maintaining separate data structures as this code did is a recipe for even more problems when the structures are manipulated separately, leading to confusing or incorrect behavior on unlocks. 3) Areas with locked memory cannot be deleted, nor can the pages which are locked be removed from the areas/caches. This of course is most notable when destroying teams which locked memory, but the problem also occurs when just using delete_area, resize_area, mmap/munmap, etc. Because of (2) and especially (3), adding support for mlock()-like semantics to the existing memory locking system is just not a good option. A further reason is that our lock_memory is much stricter than mlock(), which only demands the pages in question must remain resident in RAM and cannot be swapped out (or, it seems, otherwise written back to disk.) Thus, this commit completely removes the old implementation (which was seriously broken and did not actually automatically unlock memory on team exit or area destruction at all, etc.) and instead adds a new feature to VMAnonymousCache to block certain pages from being written out. The syscall then just invokes this to do its work. Fixes #17674. Related to #13651. Change-Id: Id2745c51796bcf9a74ba5325fe686a95623cd521 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5147 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
8e74e307 |
|
29-May-2020 |
Michael Lotz <mmlr@mlotz.ch> |
kernel/vm: Add discard_address_range that discards pages. Pages in the given range are unmapped and freed without getting written back anywhere. It can be used whenever a caller does not care about the data in the given range anymore and wants to reduce page pressure. Change-Id: I8bcce68fab278efef710d3714677e1d463504a56 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2843 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
d6ddb118 |
|
05-May-2020 |
Michael Lotz <mmlr@mlotz.ch> |
kernel/vm: Whitespace cleanup only.
|
#
d8d403ef |
|
05-May-2020 |
Michael Lotz <mmlr@mlotz.ch> |
VMAnonymousCache: Reuse _FreeSwapPageRange in destructor. The use of individual _SwapBlockGetAddress() and _SwapBlockFree() calls would lock and unlock the swap hash for each page. Using _FreeSwapPageRange() also allows to skip entire blocks when they are not present or get empty early. Change-Id: Ia76735e514cf8967d282e099cf5409fe1b104297 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2590 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
4e2b49bc |
|
04-May-2020 |
Michael Lotz <mmlr@mlotz.ch> |
kernel/vm: Implement swap adoption for cut_area middle case. Rename MovePageRange to Adopt and group it with Resize/Rebase as it covers the third, middle cut case. Implement VMAnonymousCache::Adopt() to actually adopt swap pages. This has to recreate swap blocks instead of taking them over from the source cache as the cut offset or base offset between the caches may not be swap block aligned. This means that adoption may fail due to memory shortage in allocating the swap blocks. For the middle cut case it is therefore now possible to have the adopt fail in which case the previous cache restore logic is applied. Since the readoption of the pages from the second cache can fail for the same reason, there is a slight chance that we can't restore and lose pages. For now, just panic in such a case and add a TODO to free memory and retry. Change-Id: I9a661f00c8f03bbbea2fe6dee90371c68d7951e6 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2588 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
1702afeb |
|
03-May-2020 |
Michael Lotz <mmlr@mlotz.ch> |
VMAnonymousCache: Factor out page freeing from Resize/Rebase. Except for the offsets the code was identical. Also simplify the conditions with early returns. Change-Id: Ia7c44578ab06e571f6bf992db6c6d3493fd93230 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2582 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
c6657ffe |
|
15-Apr-2012 |
Hamish Morrison <hamish@lavabit.com> |
Resize caches in all cases when cutting areas * Adds VMCache::MovePageRange() and VMCache::Rebase() to facilitate this. Applied on top of hrev45098 and rebased with the hrev45564 page_num_t to off_t change included. Change-Id: Ie61bf43696783e3376fb4144ddced3781aa092ba Reviewed-on: https://review.haiku-os.org/c/haiku/+/2581 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
d02aaee1 |
|
15-Dec-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel, libroot: Add more memory info in system_info system_info now contains all information previously available only through __get_system_info_etc(B_MEMORY_INFO, ...).
|
#
dc0e22d8 |
|
27-Apr-2013 |
Jerome Duval <jerome.duval@gmail.com> |
Revert "VMAnonymousCache.cpp: changed page_index type to page_num_t" This reverts commit f7176b0ee50d5367762d904a943a693b0a8e3e2f. Citing Ingo: "off_t is the correct type to use for addressing pages in a cache/file, which page_num_t should only be used for physical pages." I'll see how to fix the GCC 4.7 warnings differently :)
|
#
f7176b0e |
|
26-Apr-2013 |
Jérôme Duval <jerome.duval@gmail.com> |
VMAnonymousCache.cpp: changed page_index type to page_num_t * consistently use page_num_t for page numbers and off_t for offsets and sizes.
|
#
d1f280c8 |
|
01-Apr-2012 |
Hamish Morrison <hamishm53@gmail.com> |
Add support for pthread_attr_get/setguardsize() * Added the aforementioned functions. * create_area_etc() now takes a guard size parameter. * The thread_info::stack_base/end range now refers to the usable range only.
|
#
f8154d17 |
|
02-Nov-2011 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
mmlr (distracted) + bonefish: * Turn VMCache::consumers C list into a DoublyLinkedList. * Use object caches for the different VMCache types and the VMCacheRefs. The purpose is to reduce slab area fragmentation. * Requires the introduction of a pure virtual VMCache::DeleteObject() method, implemented in the derived classes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43133 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b0ee1941 |
|
02-Nov-2011 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Revert change that did accidentally sneak into the style cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43124 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ab3d6a3e |
|
02-Nov-2011 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Style cleanup. No functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43122 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8c9b84a5 |
|
02-Jun-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Replaced the swap_addr_t and SWAP_SLOT_NONE in RadixBitmap.{h,cpp} by radix_slot_t and RADIX_SLOT_NONE. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36998 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
435c43f5 |
|
02-Jun-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduced type generic_io_vec, which is similar to iovec, but uses types that are wide enough for both virtual and physical addresses. * DMABuffer, IORequest, IOScheduler,... and code using them: Use generic_io_vec and generic_{addr,size}_t where necessary. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36997 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
efeca209 |
|
20-Apr-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Made VMCache::Resize() virtual and let VMAnonymousCache override it to free swap space when the cache shrinks. Currently the implementation stil leaks swap space of busy pages. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36373 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
86875ad9 |
|
13-Apr-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added VMCache::DebugHasPage() and DebugLookupPage() for use in the kernel debugger. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36228 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
deee8524 |
|
26-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduced {malloc,memalign,free}_etc() which take an additional "flags" argument. They replace the previous special-purpose allocation functions (malloc_nogrow(), vip_io_request_malloc()). * Moved the I/O VIP heap to heap.cpp accordingly. * Added quite a bit of passing around of allocation flags in the VM, particularly in the VM*AddressSpace classes. * Fixed IOBuffer::GetNextVirtualVec(): It was ignoring the VIP flag and always allocated on the normal heap. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35316 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
|
#
c2d5972b |
|
26-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Moved merging swap pages from Merge() to a separate method. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34779 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4566a632 |
|
26-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Some style cleanup. * Pulled the code moving the pages out of Merge() into a separate method. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34778 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
be7328a9 |
|
07-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Moved VMCache related definitions to <vm/VMCache.h>. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34535 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
|
#
b0db552c |
|
01-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Renamed vm_address_space to VMAddressSpace. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34422 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1af7d115 |
|
10-Oct-2009 |
Michael Lotz <mmlr@mlotz.ch> |
* Rework page writing to combine page writes where possible. For now the pages are required to be physically contiguos, which should be reworked to put them into seperate iovecs. Still this manages to combine a great deal of page writes into larger bursts already. Reduces the amount of IO requests being scheduled (and greatly benefits media where page wise writes are slow when they are accessed through a non-IOScheduler path, i.e. USB mass storage until that is properly implemented). * Abstracted per page page writing tasks into a PageWriteWrapper class. * Abstracted per transfer page writing tasks into PageWriteTransfer class which formerly was the PageWriterCallback. * Use both classes from the PageWriterRun and from vm_page_write_modified_page_range to remove code duplication. * Adjusted synchronous VMAnonymousCache::Write() to cope correctly with larger iovecs and more than one iovec. It assumed that there was exactly one page per vector previously. * Introduced MaxPagesPerWrite() and MaxPagesPerAsyncWrite() to VMCache to allow a cache to specify restricitions. VMAnonymousCache does restrict the max pages to 1 for WriteAsync right now as I didn't feel like reworking that one to cope with non single page writes just yet. * Pulled out PageWriteTransfer methods for better readability. * Some typo fixes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33507 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
65d2b8a8 |
|
20-Apr-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduces VMCache::CanWritePage() returning whether the given cache can theoretically write the given page. * page writer: Fixed the incorrect check whether a temporary page can be written by using the new CanWritePage(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30281 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4eaa43ac |
|
11-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added "flags" parameter to VMCache::Read(). * Use the new VMCache::Read() flags parameter to directly read into the physical page in the page fault handler instead of mapping it first. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27966 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4787aab9 |
|
02-Oct-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Fixed the build when ENABLE_SWAP_SUPPORT is not defined. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27838 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ca7cb625 |
|
17-Sep-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Implemented a (private for now) get_system_info_etc() call, that can retrieve various system information. * Implemented retrieving some VM stats via this call. * The VM now maintains a page fault counter, and sets system_info::page_faults accordingly. * Added a (pretty simple) "vmstat" command line app. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27597 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ed436195 |
|
23-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* vm_page: Swapped members usage_count and wired_count. We lost 4 bytes due to alignment padding before. * Reorganized merging of caches a bit. Renamed MergeStore() to Merge() and moved some more functionality into it. The method also moves the pages from source to consumer, now. This is necessary, since VMAnonymousCache needs to consider both physical pages and swap pages at the same time. Before we first moved the physical pages and the swap pages later, which was broken for two reasons: (1) A swap page in the consumer cache shadows a physical page of the source cache, which we ignored. (2) A source cache's physical page that also had a swap page would lose the latter in the process when moved to the consumer cache, i.e. if the page was not marked modified, it could be stolen and its data would be lost. These changes improve the situation when building Haiku with 256 MB RAM in that jam doesn't crash anymore, but in my test the system became totally unusable after about an hour or 7000 targets (GUI froze). For some reason it didn't manage to free pages anymore although swapping heavily. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27179 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
aab58d87 |
|
20-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Implemented (a simple) WriteAsync(), i.e. swap pages are now written asynchronously, too. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27077 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7fd3b447 |
|
18-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Patch by Zhao Shuai with small changes by myself: * Some renaming: A location in a swap file where a page can be stored is now called "slot" instead of "page" or "swap page". * swap_slot_alloc(): Update the hint more correctly after allocating slots at the hint. * swap_space_reserve(): When less than the requested space could be reserved, it always returned 0 and leaked the remaining pages. * swap_file_delete(): sSwapFileListLock wasn't unlocked in error cases. Use MutexLocker now. * swap_free_page_swap_space(): sAvailSwapSpace wasn't updated. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27057 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
2a79a768 |
|
18-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* VMCache::Write(): Added "uint32 flags" argument which is supposed to be passed on to the IORequest. Most relevantly physical pages can now be written directly by passing B_PHYSICAL_IO_REQUEST. * Added VMCache::WriteAsync() which is supposed to write pages asynchronously. The base class version version falls back to the synchronous Write(). Only VMVnodeCache implements WriteAsync() ATM, VMAnonymousCache (swap support) still has to be adjusted accordingly. * write_page() doesn't need to map the page anymore as it can write the physical page directly. * Modified the page writer to write pages asynchronously. This shouldn't have any noticeable effect yet. It will though as soon as the I/O scheduler reorders I/O operations. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27056 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4431edd4 |
|
14-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Patch by Zhao Shuai with minor changes by myself: * Moved the static functions to the beginning of the file. * Renamed several variables for more clarity, particularly offset/cacheOffset to index/pageIndex in case where the unit is pages. * _SwapBlock{Build,Free}() can deal with a range of pages now, which should be more efficient. * Additional checks/panics in swap_page_alloc(). * swap_file_add(): Wrong byte count was used when allocating and clearing the bitmap. * swap_page_alloc(): Fixed off-by-one check. The last page of the swap file could not be used. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26975 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
77acd7fe |
|
10-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Patch by Zhao Shuai with some changes by myself: * Added functions swap_free_page_swap_space(), swap_available_pages(), and swap_total_swap_pages(). They will be used by the page daemon code. * Free allocated swap space in the VMAnonymousCache destructor. * Write(): First free swap space assigned to the pages to be written (was leaked before) and update fAllocatedSwapSize upfront. Both is now done with the cache locked, as it should be. * Fixes several instance where the cache offset in bytes was used instead of in pages. * Print the correct error when _kern_write_stat() fails. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26926 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
35560421 |
|
03-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Patch by Zhao Shuai with changes by myself: * Keep track of the stack space actually allocated for the cache and let Write() fail when we've already allocated as much as reserved. * Added second phase of swap initialization (swap_init_post_modules()) which reads the virtual memory driver settings and creates/resizes a swap file. ATM truncate() is used to resize the swap file, but that is a bit slow. We should probably introduce a VFS function to use BFS's fast method. This should make swap support work somewhat, but since swap space is never freed ATM this would be a relatively short pleasure. Still disabled by default. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26783 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c53e844a |
|
26-Jul-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Moved ENABLE_SWAP_SUPPORT definition to vm_types.h git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26640 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c586076d |
|
24-Jul-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Patch by Zhao Shuai with changes by myself: * Init swap support in main(). * Added "bool swappable" parameter to VMCacheFactory::CreateAnonymousCache(). A cache supporting swapping is created when true. Adjusted invocations accordingly. * The page writer does now write non-locked swappable pages (when memory is low). * Fixed header guard of VMAnonymousNoSwapCache.h. * Swap support is compiled conditionally, controlled by the ENABLE_SWAP_SUPPORT in src/system/kernel/vm/VMAnonymousCache.h. It is disabled ATM. Since no swap files are added, it wouldn't have much effect anyway. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26625 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e6bd90c5 |
|
23-Jul-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* bfs_fsync() was the only place which could cause the fs_vnode_ops::write_pages() to be called with fsReenter = true. Since this is no longer the case, the argument has become superfluous. For read_pages() it always was. Removed the argument from the functions and all functions that propagated it. * Some whitespace at the end of lines was removed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26579 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5c99d639 |
|
22-Jul-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Merged branch haiku/branches/developer/bonefish/vm into trunk. This introduces the following relevant changes: * VMCache: - Renamed vm_cache to VMCache, merged it with vm_store and made it a C++ class with virtual methods (replacing the store operations). Turned the different store implementations into subclasses. - Introduced MergeStore() callback, changed semantics of Commit(). - Changed locking and referencing semantics. A reference can only be acquired/released with the cache locked. An unreferenced cache is deleted and a mergeable cache merged when it is unlocked. This removes the "busy" state of a cache and simplifies the page fault code. * Added VMAnonymousCache, which will implement swap support (work by Zhao Shuai). It is not integrated and used yet, though. * Enabled the mutex/recursive lock holder asserts. * Fixed DoublyLinkedList::Swap(). * Generalized the low memory handler to a low resource handler. And made semaphores and reserved memory handled resources. Made vm_try_resource_memory() optionally wait (with timeout), and used that feature to reserve memory for areas. ... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26572 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
d02aaee17e007631fcfa91a012ec7b6386927012 |
|
15-Dec-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
kernel, libroot: Add more memory info in system_info system_info now contains all information previously available only through __get_system_info_etc(B_MEMORY_INFO, ...).
|
#
dc0e22d800a74411e312c9cafba745ffbd049a05 |
|
27-Apr-2013 |
Jerome Duval <jerome.duval@gmail.com> |
Revert "VMAnonymousCache.cpp: changed page_index type to page_num_t" This reverts commit f7176b0ee50d5367762d904a943a693b0a8e3e2f. Citing Ingo: "off_t is the correct type to use for addressing pages in a cache/file, which page_num_t should only be used for physical pages." I'll see how to fix the GCC 4.7 warnings differently :)
|
#
f7176b0ee50d5367762d904a943a693b0a8e3e2f |
|
26-Apr-2013 |
Jérôme Duval <jerome.duval@gmail.com> |
VMAnonymousCache.cpp: changed page_index type to page_num_t * consistently use page_num_t for page numbers and off_t for offsets and sizes.
|
#
d1f280c80529d5f0bc55030c2934f9255bc7f6a2 |
|
01-Apr-2012 |
Hamish Morrison <hamishm53@gmail.com> |
Add support for pthread_attr_get/setguardsize() * Added the aforementioned functions. * create_area_etc() now takes a guard size parameter. * The thread_info::stack_base/end range now refers to the usable range only.
|
#
f8154d172da77bd77316f14c76d428bae7376323 |
|
02-Nov-2011 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
mmlr (distracted) + bonefish: * Turn VMCache::consumers C list into a DoublyLinkedList. * Use object caches for the different VMCache types and the VMCacheRefs. The purpose is to reduce slab area fragmentation. * Requires the introduction of a pure virtual VMCache::DeleteObject() method, implemented in the derived classes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43133 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b0ee1941f3d23f67837fa3ed7d039e8b3ca7a263 |
|
02-Nov-2011 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Revert change that did accidentally sneak into the style cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43124 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ab3d6a3eafbd2e5fe3d66315550ec2231914c585 |
|
02-Nov-2011 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Style cleanup. No functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43122 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8c9b84a588efb095b37ea5bc99a60ecfef46f17e |
|
02-Jun-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Replaced the swap_addr_t and SWAP_SLOT_NONE in RadixBitmap.{h,cpp} by radix_slot_t and RADIX_SLOT_NONE. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36998 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
435c43f5912b109e7d5cf682865d2061e62fad8c |
|
02-Jun-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduced type generic_io_vec, which is similar to iovec, but uses types that are wide enough for both virtual and physical addresses. * DMABuffer, IORequest, IOScheduler,... and code using them: Use generic_io_vec and generic_{addr,size}_t where necessary. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36997 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
efeca209a19f0c149b38f4ffc441be77921c1776 |
|
20-Apr-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Made VMCache::Resize() virtual and let VMAnonymousCache override it to free swap space when the cache shrinks. Currently the implementation stil leaks swap space of busy pages. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36373 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
86875ad9d13d4ac67092fade0f423f261b19d417 |
|
13-Apr-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added VMCache::DebugHasPage() and DebugLookupPage() for use in the kernel debugger. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36228 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
deee8524b7534d9b586cbcbf366d0660c9769a8e |
|
26-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduced {malloc,memalign,free}_etc() which take an additional "flags" argument. They replace the previous special-purpose allocation functions (malloc_nogrow(), vip_io_request_malloc()). * Moved the I/O VIP heap to heap.cpp accordingly. * Added quite a bit of passing around of allocation flags in the VM, particularly in the VM*AddressSpace classes. * Fixed IOBuffer::GetNextVirtualVec(): It was ignoring the VIP flag and always allocated on the normal heap. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35316 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
|
#
c2d5972b6a4c263230d1c2b611e437319ffb228f |
|
26-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Moved merging swap pages from Merge() to a separate method. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34779 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4566a632c6f4b22de3ece2be8d0a30d320cf4747 |
|
26-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Some style cleanup. * Pulled the code moving the pages out of Merge() into a separate method. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34778 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
be7328a9f6b3c55eec71d403a0367d80fd4ebd12 |
|
07-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Moved VMCache related definitions to <vm/VMCache.h>. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34535 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
|
#
b0db552cd921ff16d61400ee5a5f855f392e8b87 |
|
01-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Renamed vm_address_space to VMAddressSpace. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34422 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1af7d115046ccc76641973fe434ed5760e6fdd20 |
|
10-Oct-2009 |
Michael Lotz <mmlr@mlotz.ch> |
* Rework page writing to combine page writes where possible. For now the pages are required to be physically contiguos, which should be reworked to put them into seperate iovecs. Still this manages to combine a great deal of page writes into larger bursts already. Reduces the amount of IO requests being scheduled (and greatly benefits media where page wise writes are slow when they are accessed through a non-IOScheduler path, i.e. USB mass storage until that is properly implemented). * Abstracted per page page writing tasks into a PageWriteWrapper class. * Abstracted per transfer page writing tasks into PageWriteTransfer class which formerly was the PageWriterCallback. * Use both classes from the PageWriterRun and from vm_page_write_modified_page_range to remove code duplication. * Adjusted synchronous VMAnonymousCache::Write() to cope correctly with larger iovecs and more than one iovec. It assumed that there was exactly one page per vector previously. * Introduced MaxPagesPerWrite() and MaxPagesPerAsyncWrite() to VMCache to allow a cache to specify restricitions. VMAnonymousCache does restrict the max pages to 1 for WriteAsync right now as I didn't feel like reworking that one to cope with non single page writes just yet. * Pulled out PageWriteTransfer methods for better readability. * Some typo fixes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33507 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
65d2b8a8e9fefd59eb270d7c0030ebe85b75d553 |
|
20-Apr-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduces VMCache::CanWritePage() returning whether the given cache can theoretically write the given page. * page writer: Fixed the incorrect check whether a temporary page can be written by using the new CanWritePage(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30281 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4eaa43ac48bb4936de09b85827893c9beb90b51c |
|
11-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added "flags" parameter to VMCache::Read(). * Use the new VMCache::Read() flags parameter to directly read into the physical page in the page fault handler instead of mapping it first. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27966 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4787aab9610dbe0576c5105bd14cc2d71f908954 |
|
02-Oct-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Fixed the build when ENABLE_SWAP_SUPPORT is not defined. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27838 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ca7cb625b9769be2657365e2137197bdc3a9692d |
|
17-Sep-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Implemented a (private for now) get_system_info_etc() call, that can retrieve various system information. * Implemented retrieving some VM stats via this call. * The VM now maintains a page fault counter, and sets system_info::page_faults accordingly. * Added a (pretty simple) "vmstat" command line app. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27597 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ed4361950042b6748c86aeb547fe471185e67dc1 |
|
23-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* vm_page: Swapped members usage_count and wired_count. We lost 4 bytes due to alignment padding before. * Reorganized merging of caches a bit. Renamed MergeStore() to Merge() and moved some more functionality into it. The method also moves the pages from source to consumer, now. This is necessary, since VMAnonymousCache needs to consider both physical pages and swap pages at the same time. Before we first moved the physical pages and the swap pages later, which was broken for two reasons: (1) A swap page in the consumer cache shadows a physical page of the source cache, which we ignored. (2) A source cache's physical page that also had a swap page would lose the latter in the process when moved to the consumer cache, i.e. if the page was not marked modified, it could be stolen and its data would be lost. These changes improve the situation when building Haiku with 256 MB RAM in that jam doesn't crash anymore, but in my test the system became totally unusable after about an hour or 7000 targets (GUI froze). For some reason it didn't manage to free pages anymore although swapping heavily. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27179 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
aab58d8730c95bb3f82ec4060a4c3476d421024b |
|
20-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Implemented (a simple) WriteAsync(), i.e. swap pages are now written asynchronously, too. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27077 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7fd3b44794d35fec259510688dd6ed51628f4256 |
|
18-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Patch by Zhao Shuai with small changes by myself: * Some renaming: A location in a swap file where a page can be stored is now called "slot" instead of "page" or "swap page". * swap_slot_alloc(): Update the hint more correctly after allocating slots at the hint. * swap_space_reserve(): When less than the requested space could be reserved, it always returned 0 and leaked the remaining pages. * swap_file_delete(): sSwapFileListLock wasn't unlocked in error cases. Use MutexLocker now. * swap_free_page_swap_space(): sAvailSwapSpace wasn't updated. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27057 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
2a79a7686f90e5720024387dd90f8e058d13b044 |
|
18-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* VMCache::Write(): Added "uint32 flags" argument which is supposed to be passed on to the IORequest. Most relevantly physical pages can now be written directly by passing B_PHYSICAL_IO_REQUEST. * Added VMCache::WriteAsync() which is supposed to write pages asynchronously. The base class version version falls back to the synchronous Write(). Only VMVnodeCache implements WriteAsync() ATM, VMAnonymousCache (swap support) still has to be adjusted accordingly. * write_page() doesn't need to map the page anymore as it can write the physical page directly. * Modified the page writer to write pages asynchronously. This shouldn't have any noticeable effect yet. It will though as soon as the I/O scheduler reorders I/O operations. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27056 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4431edd45316b194c961996c005f38f9999f52a0 |
|
14-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Patch by Zhao Shuai with minor changes by myself: * Moved the static functions to the beginning of the file. * Renamed several variables for more clarity, particularly offset/cacheOffset to index/pageIndex in case where the unit is pages. * _SwapBlock{Build,Free}() can deal with a range of pages now, which should be more efficient. * Additional checks/panics in swap_page_alloc(). * swap_file_add(): Wrong byte count was used when allocating and clearing the bitmap. * swap_page_alloc(): Fixed off-by-one check. The last page of the swap file could not be used. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26975 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
77acd7fece7e4d3eb146cac7cfa67b4d3ececdb8 |
|
10-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Patch by Zhao Shuai with some changes by myself: * Added functions swap_free_page_swap_space(), swap_available_pages(), and swap_total_swap_pages(). They will be used by the page daemon code. * Free allocated swap space in the VMAnonymousCache destructor. * Write(): First free swap space assigned to the pages to be written (was leaked before) and update fAllocatedSwapSize upfront. Both is now done with the cache locked, as it should be. * Fixes several instance where the cache offset in bytes was used instead of in pages. * Print the correct error when _kern_write_stat() fails. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26926 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
355604212d43a7a476436ee0df209043d52c0872 |
|
03-Aug-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Patch by Zhao Shuai with changes by myself: * Keep track of the stack space actually allocated for the cache and let Write() fail when we've already allocated as much as reserved. * Added second phase of swap initialization (swap_init_post_modules()) which reads the virtual memory driver settings and creates/resizes a swap file. ATM truncate() is used to resize the swap file, but that is a bit slow. We should probably introduce a VFS function to use BFS's fast method. This should make swap support work somewhat, but since swap space is never freed ATM this would be a relatively short pleasure. Still disabled by default. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26783 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c53e844a899ad5fe9179edf99ef87702eb24526e |
|
26-Jul-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Moved ENABLE_SWAP_SUPPORT definition to vm_types.h git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26640 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c586076dcafe59a79b7f3073f2471497d62b29af |
|
24-Jul-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Patch by Zhao Shuai with changes by myself: * Init swap support in main(). * Added "bool swappable" parameter to VMCacheFactory::CreateAnonymousCache(). A cache supporting swapping is created when true. Adjusted invocations accordingly. * The page writer does now write non-locked swappable pages (when memory is low). * Fixed header guard of VMAnonymousNoSwapCache.h. * Swap support is compiled conditionally, controlled by the ENABLE_SWAP_SUPPORT in src/system/kernel/vm/VMAnonymousCache.h. It is disabled ATM. Since no swap files are added, it wouldn't have much effect anyway. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26625 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e6bd90c58dbae64f3b464edcff90dcb06e63a716 |
|
23-Jul-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* bfs_fsync() was the only place which could cause the fs_vnode_ops::write_pages() to be called with fsReenter = true. Since this is no longer the case, the argument has become superfluous. For read_pages() it always was. Removed the argument from the functions and all functions that propagated it. * Some whitespace at the end of lines was removed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26579 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5c99d639708df9b4e2cc847b38d510149d19ec78 |
|
22-Jul-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Merged branch haiku/branches/developer/bonefish/vm into trunk. This introduces the following relevant changes: * VMCache: - Renamed vm_cache to VMCache, merged it with vm_store and made it a C++ class with virtual methods (replacing the store operations). Turned the different store implementations into subclasses. - Introduced MergeStore() callback, changed semantics of Commit(). - Changed locking and referencing semantics. A reference can only be acquired/released with the cache locked. An unreferenced cache is deleted and a mergeable cache merged when it is unlocked. This removes the "busy" state of a cache and simplifies the page fault code. * Added VMAnonymousCache, which will implement swap support (work by Zhao Shuai). It is not integrated and used yet, though. * Enabled the mutex/recursive lock holder asserts. * Fixed DoublyLinkedList::Swap(). * Generalized the low memory handler to a low resource handler. And made semaphores and reserved memory handled resources. Made vm_try_resource_memory() optionally wait (with timeout), and used that feature to reserve memory for areas. ... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26572 a95241bf-73f2-0310-859d-f6bbb57e9c96
|