mirror of
https://review.haiku-os.org/haiku
synced 2025-01-20 21:41:28 +01:00
eb8dc1ebfb
* 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
98 lines
2.6 KiB
C
98 lines
2.6 KiB
C
#ifndef KERNEL_DEBUG_CONFIG_H
|
|
#define KERNEL_DEBUG_CONFIG_H
|
|
|
|
// Master switch:
|
|
// 0: Disables all debug code that hasn't been enabled otherwise.
|
|
// 1: Enables some lightweight debug code.
|
|
// 2: Enables more debug code. Will impact performance.
|
|
#define KDEBUG_LEVEL 2
|
|
|
|
#define KDEBUG_LEVEL_2 (KDEBUG_LEVEL >= 2)
|
|
#define KDEBUG_LEVEL_1 (KDEBUG_LEVEL >= 1)
|
|
#define KDEBUG_LEVEL_0 (KDEBUG_LEVEL >= 0)
|
|
|
|
|
|
// general kernel debugging
|
|
|
|
// Enables kernel ASSERT()s and various checks, locking primitives aren't
|
|
// benaphore-style.
|
|
#define KDEBUG KDEBUG_LEVEL_2
|
|
|
|
// Size of the heap used by the kernel debugger.
|
|
#define KDEBUG_HEAP (64 * 1024)
|
|
|
|
// Set to 0 to disable support for kernel breakpoints.
|
|
#define KERNEL_BREAKPOINTS 1
|
|
|
|
|
|
// block/file cache
|
|
|
|
// Enables debugger commands.
|
|
#define DEBUG_BLOCK_CACHE KDEBUG_LEVEL_1
|
|
|
|
// Enables checks that non-dirty blocks really aren't changed. Seriously
|
|
// degrades performance when the block cache is used heavily.
|
|
#define BLOCK_CACHE_DEBUG_CHANGED KDEBUG_LEVEL_2
|
|
|
|
// Enables a global list of file maps and related debugger commands.
|
|
#define DEBUG_FILE_MAP KDEBUG_LEVEL_1
|
|
|
|
|
|
// heap
|
|
|
|
// Initialize newly allocated memory with something non zero.
|
|
#define PARANOID_KERNEL_MALLOC KDEBUG_LEVEL_2
|
|
|
|
// Check for double free, and fill freed memory with 0xdeadbeef.
|
|
#define PARANOID_KERNEL_FREE KDEBUG_LEVEL_2
|
|
|
|
// Validate sanity of the heap after each operation (slow!).
|
|
#define PARANOID_HEAP_VALIDATION 0
|
|
|
|
// Store size, thread and team info at the end of each allocation block.
|
|
// Enables the "allocations*" debugger commands.
|
|
#define KERNEL_HEAP_LEAK_CHECK 0
|
|
|
|
|
|
// interrupts
|
|
|
|
// Adds statistics and unhandled counter per interrupts. Enables the "ints"
|
|
// debugger command.
|
|
#define DEBUG_INTERRUPTS KDEBUG_LEVEL_1
|
|
|
|
|
|
// semaphores
|
|
|
|
// Enables tracking of the last threads that acquired/released a semaphore.
|
|
#define DEBUG_SEM_LAST_ACQUIRER KDEBUG_LEVEL_1
|
|
|
|
|
|
// SMP
|
|
|
|
// Enables spinlock caller debugging. When acquiring a spinlock twice on a
|
|
// non-SMP machine, this will give a clue who locked it the first time.
|
|
// Furthermore (also on SMP machines) the "spinlock" debugger command will be
|
|
// available.
|
|
#define DEBUG_SPINLOCKS KDEBUG_LEVEL_2
|
|
|
|
#define DEBUG_SPINLOCK_LATENCIES 0
|
|
|
|
|
|
// VM
|
|
|
|
// Enables the vm_page::queue, i.e. it is tracked which queue the page should
|
|
// be in.
|
|
#define DEBUG_PAGE_QUEUE 0
|
|
|
|
// Enables a global list of all vm_cache structures.
|
|
#define DEBUG_CACHE_LIST KDEBUG_LEVEL_1
|
|
|
|
// Enables swap support.
|
|
#define ENABLE_SWAP_SUPPORT 1
|
|
|
|
// When set limits the amount of available RAM (in MB).
|
|
//#define LIMIT_AVAILABLE_MEMORY 256
|
|
|
|
|
|
#endif // KERNEL_DEBUG_CONFIG_H
|