kernel/vm: Change free swap reporting to actually free pages.
Previously system_info->free_swap_pages was using swap_available_pages which has reservations removed. Tools like ActivityMonitor would therefore show mere reservations as swap use which is misleading at best. Switch to use the sum of the free slots of all swap files instead. This doesn't add overhead as the swap file list was already locked and traversed for max_swap_pages before (via swap_total_swap_pages()). Fixes #16248. Change-Id: I3ebf223ec108bf342d4f32d68405170e72528899 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2917 Reviewed-by: Axel Dörfler <axeld@pinc-software.de> Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
29ae0e0f61
commit
2778057ccd
|
@ -1752,8 +1752,12 @@ void
|
|||
swap_get_info(system_info* info)
|
||||
{
|
||||
#if ENABLE_SWAP_SUPPORT
|
||||
info->max_swap_pages = swap_total_swap_pages();
|
||||
info->free_swap_pages = swap_available_pages();
|
||||
MutexLocker locker(sSwapFileListLock);
|
||||
for (SwapFileList::Iterator it = sSwapFileList.GetIterator();
|
||||
swap_file* swapFile = it.Next();) {
|
||||
info->max_swap_pages += swapFile->last_slot - swapFile->first_slot;
|
||||
info->free_swap_pages += swapFile->bmp->free_slots;
|
||||
}
|
||||
#else
|
||||
info->max_swap_pages = 0;
|
||||
info->free_swap_pages = 0;
|
||||
|
|
Loading…
Reference in New Issue