#
76681bd9 |
|
22-Sep-2023 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel: Rewrite B_DEBUG_SPINLOCK_CONTENTION. * Replace count_low/count_high with bigtime_t fields plus an int32. sizeof(spinlock) is now 32 bytes with the debug option enabled. * Adjust and clean up all spinlock code to use the new fields. * Fold DEBUG_SPINLOCK_LATENCIES into the new code. Remove the bootloader option and other flags for it (these were not compiled in by default.) The new code should be much easier to understand and also more powerful. However, the information transmitted to userland isn't as useful now; the KDL command output will have the interesting information. (Things could be reworked to transmit more interesting information to userland again if desired, but as this code clearly hadn't been compiled for many years, as it referred to global spinlocks that have been gone for a very long time.) Change-Id: I2cb34078bfdc7604f288a297b6cd1aa7ff9cc512 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6943 Reviewed-by: waddlesplash <waddlesplash@gmail.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
|
#
a267f17c |
|
13-Aug-2021 |
X512 <danger_mail@list.ru> |
kernel/vm: fix several vm bugs in riscv64 team.cpp address_space change is needed in arch_thread_init_kthread_stack to set initial thread page translation map. It also allows to simplify some debugger code. DEBUG_PAGE_ACCESS check is currently incorrectly implemented in RISCV64VMTranslationMap and disabled to avoid panic. gHtifRegs = 0 change is needed to avoid using HTIF when it is not available. gHtifRegs != NULL check is used to detect that HTIF is present. 0x40008000 is TinyEMU HTIF address. HTIF is emulator specific device that provide serial IO and shutdown capability (and maybe something else depending on virtual machine). Change-Id: Ic4d567b28c49799ae0f55223dd983a752823bab4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4328 Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
|
#
44a4bc5f |
|
22-May-2020 |
Kyle Ambroff-Kao <kyle@ambroffkao.com> |
tcp: Remove sanity checks from BufferQueue in release builds Each TCPEndpoint has two BufferQueue members, one for the send queue and one for the receive queue. If DEBUG_BUFFER_QUEUE is enabled, then most methods of BufferQueue call BufferQueue::Verify(), sometimes twice. This member function performs some sanity checking which requires iterating through every net_buffer in the queue. Disabling this in a debug build improved throughput by a factor of 5x over the loopback interface on my laptop. Using iperf the measured throughput went from 900Mbps to around 4.8Gbps. This patch turns this sanity checking off for release builds. * Rename DEBUG_BUFFER_QUEUE to DEBUG_TCP_BUFFER_QUEUE * Change the default in BufferQueue.h to disabled * Set DEBUG_TCP_BUFFER_QUEUE to KDEBUG_LEVEL_2 in kernel_debug_config.h Change-Id: I262dac5d7e2889d2942bbdcf6b667cc0cbafa4c8 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2780 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
cac30e41 |
|
08-May-2020 |
Augustin Cavalier <waddlesplash@gmail.com> |
kernel_debug_config: Move global VMCache option to KDEBUG_LEVEL_2. It does have a performance impact (as it serializes all VMCache creations), and it is not that useful, so move it to KDEBUG_LEVEL_2 so that the beta releases (on KDEBUG_LEVEL_1) are not affected by it. (The nightlies are on KDEBUG_LEVEL_2, so this will not affect them.) Change-Id: Iab35d58f9d210651e3fd9027b75ea27a7a6928e5 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2612 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
035e3e77 |
|
15-Apr-2015 |
Axel Dörfler <axeld@pinc-software.de> |
kernel: profile system when SYSTEM_PROFILER is defined. * This enables a mechanism to profile almost the complete boot process (starting with main2()), if SYSTEM_PROFILER is defined to 1. * You can access the profiling data using "profile -r".
|
#
5cbe06f4 |
|
04-Dec-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Allow replacing the object cache with the guarded heap. This allows to use the debug features of the guarded heap also on allocations made through the object cache API. This is obivously horrible for performance and uses up huge amounts of memory, so the initial and grow sizes are adjusted accordingly. Note that this is a rather simple hack, using the object_cache pointer to transport the allocation size. The alignment is neglected completely.
|
#
1fe24d0c |
|
03-Dec-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Add heap with guard pages to detect out of bound reads/writes. This is a very simple heap implementation that allocates memory so that the end of each allocation always coincides with a page end and is followed by a guard page which is marked non-present. Out of bounds access (both read and write) therefore cause a crash (unhandled page fault). Note that this allocator is neither speed nor space efficient, indeed it wastes huge amounts of pages and address space so it is quite easy to hit limits. It is intended as a pure debug feature.
|
#
90c6930e |
|
04-Nov-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Add VM page allocation tracking similar to what happens in the slab already. Introduces "page_allocation_infos" and "page_allocations_per_caller" KDL commands. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43190 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e1c6140e |
|
01-Nov-2011 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
mmlr + bonefish: * Add optional stack trace capturing for slab memory manager tracing. * Add allocation tracking for the slab allocator (enabled via SLAB_ALLOCATION_TRACKING). The allocation tracking requires tracing with stack traces to be enabled for object caches and/or the memory manager. - Add class AllocationTrackingInfo that associates an allocation with its respective tracing entry. The structure is added to the end of an allocation done by the memory manager. For the object caches there's a separate array for each slab. - Add code range markers to the slab code, so that the first caller into the slab code can be retrieved from the stack traces. - Add KDL command "allocations_per_caller" that lists all allocations summarized by caller. * Move debug definitions from slab_private.h to slab_debug.h. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43072 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
05951b9b |
|
02-Jul-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added optional paranoid checking of the slab memory manager meta chunks after each chunk allocation/deallocation. * The commands that dump chunks also verify, whether chunks that look free are in the free list. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37360 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
60c26cd3 |
|
01-Jul-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Enabled the slab allocator as default allocator. * The previous kernel heap has only an advantage for debugging, anyway, but the actual reason for this change is bug #6232, and Haiku should crash for most people since a week now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37327 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
38c7ed7c |
|
16-Mar-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added kernel debug config option KDEBUG_ENABLE_DEBUG_SYSLOG which determines the default setting for the "debug syslog" feature (can still be overridden in the boot loader). Per default enabled for kdebug level >= 1. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35884 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b4e5e498 |
|
25-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
MemoryManager: * Added support to do larger raw allocations (up to one large chunk (128 pages)) in the slab areas. For an even larger allocation an area is created (haven't seen that happen yet, though). * Added kernel tracing (SLAB_MEMORY_MANAGER_TRACING). * _FreeArea(): Copy and paste bug: The meta chunks of the to be freed area would be added to the free lists instead of being removed from them. This would corrupt the lists and also lead to all kinds of misuse of meta chunks. object caches: * Implemented CACHE_ALIGN_ON_SIZE. It is no longer set for all small object caches, but the block allocator sets it on all power of two size caches. * object_cache_reserve_internal(): Detect recursion and don't wait in such a case. The function could deadlock itself, since HashedObjectCache::CreateSlab() does allocate memory, thus potentially reentering. * object_cache_low_memory(): - I missed some returns when reworking that one in r35254, so the function might stop early and also leave the cache in maintenance mode, which would cause it to be ignored by object cache resizer and low memory handler from that point on. - Since ReturnSlab() potentially unlocks, the conditions weren't quite correct and too many slabs could be freed. - Simplified things a bit. * object_cache_alloc(): Since object_cache_reserve_internal() does potentially unlock the cache, the situation might have changed and their might not be an empty slab available, but a partial one. The function would crash. * Renamed the object cache tracing variable to SLAB_OBJECT_CACHE_TRACING. * Renamed debugger command "cache_info" to "slab_cache" to avoid confusion with the VMCache commands. * ObjectCache::usage was not maintained anymore since I introduced the MemoryManager. object_cache_get_usage() would thus always return 0 and the block cache would not be considered cached memory. This was only of informational relevance, though. slab allocator misc.: * Disable the object depots of block allocator caches for object sizes > 2 KB. Allocations of those sizes aren't so common that the object depots yield any benefit. * The slab allocator is now fully self-sufficient. It allocates its bootstrap memory from the MemoryManager, and the hash tables for HashedObjectCaches use the block allocator instead of the heap, now. * Added option to use the slab allocator for malloc() and friends (USE_SLAB_ALLOCATOR_FOR_MALLOC). Currently disabled. Works in principle and has virtually no lock contention. Handling for low memory situations is yet missing, though. * Improved the output of some debugger commands. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35283 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b01f92eb |
|
08-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Sorry, made up my mind: KDEBUG_LEVEL_2 it is for DEBUG_PAGE_ACCESS. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34957 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b5be9fe6 |
|
08-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Accidentally left DEBUG_PAGE_ACCESS in enabled state. Mmh, maybe it would be a good idea to tie it to some KDEBUG_LEVEL. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34955 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
|
#
eb8dc1eb |
|
27-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Removed DEBUG_PAGE_CACHE_TRANSITIONS debugging. * Added VMCache::MovePage() and MoveAllPages() to move pages between caches. * VMAnonymousCache: - _MergeSwapPages(): Avoid doing anything, if neither cache has swapped out pages. - _MergeSwapPages() does now also remove source cache pages that are shadowed by consumer swap pages. This allows us to call _MergeSwapPages() before _MergePagesSmallerSource(), save the swap page shadowing check there and get rid of the vm_page::merge_swap flag. This is an optimization based on the assumption that usually none or only few pages are swapped out, so we save a lot of checks. - Implemented _MergePagesSmallerConsumer() as an alternative to _MergePagesSmallerSource(). The former is used when the source cache has more pages than the consumer cache. It iterates over the consumer cache's pages, moves them to the source and finally moves all pages back to the consumer. The final move is relatively cheap (though unfortunately we still have to update all pages' vm_page::cache field), so that overall we save iterations of the main loop with the more expensive checks. The optimizations particularly improve the common fork()+exec*() situations. fork() uses CoW, which is implemented by putting two new empty caches between the to be copied area and its cache. exec*() destroys one copy of the area, its cache and thus causes merging of the other new cache with the old cache. Since this usually happens in a very short time, the old cache does still contain many pages and the new cache only few. Previously the many pages were all checked and moved individually. Now we do that for the few pages instead. A very extreme example of this situation is the Haiku image build. jam has a huge heap (> 200 MB) and it fork()s+exec*()s for every action to be executed. Since during the cache merging the cache is locked, any write access to a heap page causes jam to block until the cache merging is done. Formerly that took so long that it killed a lot of parallelism in multi-job builds. That could be observed particularly well when lots of small actions where executed (like the Link, XRes, Mimeset, SetType, SetVersion combos when building executables/libraries/add-ons). Those look dramatically better now. The overall speed improvement for a -j8 image build on my machine is only about 15%, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34784 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6242fd59 |
|
08-Nov-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Added the possibility to debug latency issues with spinlocks. * When DEBUG_SPINLOCK_LATENCIES is 1, the system will panic if any spinlock is held longer than DEBUG_LATENCY micro seconds (currently 200). If your system doesn't boot anymore, a new safemode setting can disable the panic. * Besides some problems during boot when the MTRRs are set up, 200 usecs work fine here if all debug output is turned off (the output stuff is definitely problematic, though I don't have a good idea on how to improve upon it a lot). * Renamed the formerly BeOS compatible safemode settings to look better; there is no need to be compatible there. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33953 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
360d4974 |
|
02-Jun-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Replaced the temporary storage used in the kernel debug command parser. We now have a simple dedicated heap for the kernel debugger with stacked allocation pools (deleting a pool frees all memory allocated in it). The heap should eventually be used for all commands that need temporary storage too large for the stack instead of each using its own static buffer. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30949 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b4476702 |
|
16-Apr-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Removed most of the special-casing for kernel breakpoints in the kernel enter/exit code. There's no real reason not to keep kernel breakpoints enabled when in userland (unless there are breakpoints installed for the team, of course). * Enabled kernel breakpoints by default (check your kernel_debug_config.h, if you have overridden it!), since they don't really add any overhead anymore. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30206 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
59dbd26f |
|
20-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved more debug macros to kernel_debug_config.h. * Turned the checks for all those macros to "#if"s instead of "#ifdef"s. * Introduced macro KDEBUG_LEVEL which serves as a master setting. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28248 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6e595b29 |
|
16-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Moved KERNEL_BREAKPOINTS to kernel_debug_config.h. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28197 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e43cb37b |
|
05-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Moved several VM related debug settings to kernel_debug_config.h. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27876 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f8bdc244 |
|
01-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Created a central place for putting kernel debug enabling macros. Currently it only contains KDEBUG and the block cache debugging macros. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27816 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
035e3e77ed4550c9e9e5d932d02125be0d80d04c |
|
15-Apr-2015 |
Axel Dörfler <axeld@pinc-software.de> |
kernel: profile system when SYSTEM_PROFILER is defined. * This enables a mechanism to profile almost the complete boot process (starting with main2()), if SYSTEM_PROFILER is defined to 1. * You can access the profiling data using "profile -r".
|
#
5cbe06f482858c8b79671927e887ab08375a721c |
|
04-Dec-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Allow replacing the object cache with the guarded heap. This allows to use the debug features of the guarded heap also on allocations made through the object cache API. This is obivously horrible for performance and uses up huge amounts of memory, so the initial and grow sizes are adjusted accordingly. Note that this is a rather simple hack, using the object_cache pointer to transport the allocation size. The alignment is neglected completely.
|
#
1fe24d0cd0b547a771c00f6fca8f50ba6ca2fb2c |
|
03-Dec-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Add heap with guard pages to detect out of bound reads/writes. This is a very simple heap implementation that allocates memory so that the end of each allocation always coincides with a page end and is followed by a guard page which is marked non-present. Out of bounds access (both read and write) therefore cause a crash (unhandled page fault). Note that this allocator is neither speed nor space efficient, indeed it wastes huge amounts of pages and address space so it is quite easy to hit limits. It is intended as a pure debug feature.
|
#
90c6930ebba06f6c9b220e712a53c063a542062a |
|
04-Nov-2011 |
Michael Lotz <mmlr@mlotz.ch> |
Add VM page allocation tracking similar to what happens in the slab already. Introduces "page_allocation_infos" and "page_allocations_per_caller" KDL commands. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43190 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e1c6140eaa641aa95fc6d82f0d5c53cf4fe41a16 |
|
01-Nov-2011 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
mmlr + bonefish: * Add optional stack trace capturing for slab memory manager tracing. * Add allocation tracking for the slab allocator (enabled via SLAB_ALLOCATION_TRACKING). The allocation tracking requires tracing with stack traces to be enabled for object caches and/or the memory manager. - Add class AllocationTrackingInfo that associates an allocation with its respective tracing entry. The structure is added to the end of an allocation done by the memory manager. For the object caches there's a separate array for each slab. - Add code range markers to the slab code, so that the first caller into the slab code can be retrieved from the stack traces. - Add KDL command "allocations_per_caller" that lists all allocations summarized by caller. * Move debug definitions from slab_private.h to slab_debug.h. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43072 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
05951b9b6a3bbf94106b2167283166aae78af820 |
|
02-Jul-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added optional paranoid checking of the slab memory manager meta chunks after each chunk allocation/deallocation. * The commands that dump chunks also verify, whether chunks that look free are in the free list. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37360 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
60c26cd332a044bb9003091b9196cc404ebe5482 |
|
01-Jul-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Enabled the slab allocator as default allocator. * The previous kernel heap has only an advantage for debugging, anyway, but the actual reason for this change is bug #6232, and Haiku should crash for most people since a week now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37327 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
38c7ed7c476e4a985fee9129c8150a85237d362e |
|
16-Mar-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added kernel debug config option KDEBUG_ENABLE_DEBUG_SYSLOG which determines the default setting for the "debug syslog" feature (can still be overridden in the boot loader). Per default enabled for kdebug level >= 1. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35884 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b4e5e4982360e684c5a13d227b9a958dbe725554 |
|
25-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
MemoryManager: * Added support to do larger raw allocations (up to one large chunk (128 pages)) in the slab areas. For an even larger allocation an area is created (haven't seen that happen yet, though). * Added kernel tracing (SLAB_MEMORY_MANAGER_TRACING). * _FreeArea(): Copy and paste bug: The meta chunks of the to be freed area would be added to the free lists instead of being removed from them. This would corrupt the lists and also lead to all kinds of misuse of meta chunks. object caches: * Implemented CACHE_ALIGN_ON_SIZE. It is no longer set for all small object caches, but the block allocator sets it on all power of two size caches. * object_cache_reserve_internal(): Detect recursion and don't wait in such a case. The function could deadlock itself, since HashedObjectCache::CreateSlab() does allocate memory, thus potentially reentering. * object_cache_low_memory(): - I missed some returns when reworking that one in r35254, so the function might stop early and also leave the cache in maintenance mode, which would cause it to be ignored by object cache resizer and low memory handler from that point on. - Since ReturnSlab() potentially unlocks, the conditions weren't quite correct and too many slabs could be freed. - Simplified things a bit. * object_cache_alloc(): Since object_cache_reserve_internal() does potentially unlock the cache, the situation might have changed and their might not be an empty slab available, but a partial one. The function would crash. * Renamed the object cache tracing variable to SLAB_OBJECT_CACHE_TRACING. * Renamed debugger command "cache_info" to "slab_cache" to avoid confusion with the VMCache commands. * ObjectCache::usage was not maintained anymore since I introduced the MemoryManager. object_cache_get_usage() would thus always return 0 and the block cache would not be considered cached memory. This was only of informational relevance, though. slab allocator misc.: * Disable the object depots of block allocator caches for object sizes > 2 KB. Allocations of those sizes aren't so common that the object depots yield any benefit. * The slab allocator is now fully self-sufficient. It allocates its bootstrap memory from the MemoryManager, and the hash tables for HashedObjectCaches use the block allocator instead of the heap, now. * Added option to use the slab allocator for malloc() and friends (USE_SLAB_ALLOCATOR_FOR_MALLOC). Currently disabled. Works in principle and has virtually no lock contention. Handling for low memory situations is yet missing, though. * Improved the output of some debugger commands. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35283 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b01f92ebd1e7fa31ffc24deabf9b18c4d0a8e1c7 |
|
08-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Sorry, made up my mind: KDEBUG_LEVEL_2 it is for DEBUG_PAGE_ACCESS. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34957 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b5be9fe6ffa8b1f99a6d52bf72503674cddf6b11 |
|
08-Jan-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Accidentally left DEBUG_PAGE_ACCESS in enabled state. Mmh, maybe it would be a good idea to tie it to some KDEBUG_LEVEL. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34955 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
|
#
eb8dc1ebfbe911a6af06efe02d003aa37687faad |
|
27-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Removed DEBUG_PAGE_CACHE_TRANSITIONS debugging. * Added VMCache::MovePage() and MoveAllPages() to move pages between caches. * VMAnonymousCache: - _MergeSwapPages(): Avoid doing anything, if neither cache has swapped out pages. - _MergeSwapPages() does now also remove source cache pages that are shadowed by consumer swap pages. This allows us to call _MergeSwapPages() before _MergePagesSmallerSource(), save the swap page shadowing check there and get rid of the vm_page::merge_swap flag. This is an optimization based on the assumption that usually none or only few pages are swapped out, so we save a lot of checks. - Implemented _MergePagesSmallerConsumer() as an alternative to _MergePagesSmallerSource(). The former is used when the source cache has more pages than the consumer cache. It iterates over the consumer cache's pages, moves them to the source and finally moves all pages back to the consumer. The final move is relatively cheap (though unfortunately we still have to update all pages' vm_page::cache field), so that overall we save iterations of the main loop with the more expensive checks. The optimizations particularly improve the common fork()+exec*() situations. fork() uses CoW, which is implemented by putting two new empty caches between the to be copied area and its cache. exec*() destroys one copy of the area, its cache and thus causes merging of the other new cache with the old cache. Since this usually happens in a very short time, the old cache does still contain many pages and the new cache only few. Previously the many pages were all checked and moved individually. Now we do that for the few pages instead. A very extreme example of this situation is the Haiku image build. jam has a huge heap (> 200 MB) and it fork()s+exec*()s for every action to be executed. Since during the cache merging the cache is locked, any write access to a heap page causes jam to block until the cache merging is done. Formerly that took so long that it killed a lot of parallelism in multi-job builds. That could be observed particularly well when lots of small actions where executed (like the Link, XRes, Mimeset, SetType, SetVersion combos when building executables/libraries/add-ons). Those look dramatically better now. The overall speed improvement for a -j8 image build on my machine is only about 15%, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34784 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6242fd597772185600b922845b95c5223f8b3336 |
|
08-Nov-2009 |
Axel Dörfler <axeld@pinc-software.de> |
* Added the possibility to debug latency issues with spinlocks. * When DEBUG_SPINLOCK_LATENCIES is 1, the system will panic if any spinlock is held longer than DEBUG_LATENCY micro seconds (currently 200). If your system doesn't boot anymore, a new safemode setting can disable the panic. * Besides some problems during boot when the MTRRs are set up, 200 usecs work fine here if all debug output is turned off (the output stuff is definitely problematic, though I don't have a good idea on how to improve upon it a lot). * Renamed the formerly BeOS compatible safemode settings to look better; there is no need to be compatible there. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33953 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
360d4974b96a6821dbf4b31e0662bfcd31f713bc |
|
02-Jun-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Replaced the temporary storage used in the kernel debug command parser. We now have a simple dedicated heap for the kernel debugger with stacked allocation pools (deleting a pool frees all memory allocated in it). The heap should eventually be used for all commands that need temporary storage too large for the stack instead of each using its own static buffer. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30949 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b447670286ce35b20725cc585c250f03a08d15aa |
|
16-Apr-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Removed most of the special-casing for kernel breakpoints in the kernel enter/exit code. There's no real reason not to keep kernel breakpoints enabled when in userland (unless there are breakpoints installed for the team, of course). * Enabled kernel breakpoints by default (check your kernel_debug_config.h, if you have overridden it!), since they don't really add any overhead anymore. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30206 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
59dbd26f5f41a6c1272f6cac9c8cda4b19b79097 |
|
20-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved more debug macros to kernel_debug_config.h. * Turned the checks for all those macros to "#if"s instead of "#ifdef"s. * Introduced macro KDEBUG_LEVEL which serves as a master setting. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28248 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6e595b29e31f6c6a19c2e3ba4b0ec4e7c6e6d976 |
|
16-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Moved KERNEL_BREAKPOINTS to kernel_debug_config.h. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28197 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e43cb37bcdf44d3c2b866098e3f29a0820d9a509 |
|
05-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Moved several VM related debug settings to kernel_debug_config.h. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27876 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f8bdc2443da0549194191804a80479ee7fd4531a |
|
01-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Created a central place for putting kernel debug enabling macros. Currently it only contains KDEBUG and the block cache debugging macros. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27816 a95241bf-73f2-0310-859d-f6bbb57e9c96
|