low_resource_manager: Do not spin forever during critical low resource conditions.
Since this thread has a very high priority, this causes the whole system to lock up, making recovery from such a critical condition even more impossible. Instead use the Warning-level timeout instead (0.3 seconds), and of course we will be notified via the semaphore if something occurs we should know about.
This commit is contained in:
committed by
Ryan Leavengood
parent
47df2afbf8
commit
6cb38c6319
@@ -244,16 +244,13 @@ low_resource_manager(void*)
|
||||
{
|
||||
bigtime_t timeout = kLowResourceInterval;
|
||||
while (true) {
|
||||
int32 state = low_resource_state_no_update(B_ALL_KERNEL_RESOURCES);
|
||||
if (state != B_LOW_RESOURCE_CRITICAL) {
|
||||
acquire_sem_etc(sLowResourceWaitSem, 1, B_RELATIVE_TIMEOUT,
|
||||
timeout);
|
||||
}
|
||||
acquire_sem_etc(sLowResourceWaitSem, 1, B_RELATIVE_TIMEOUT,
|
||||
timeout);
|
||||
|
||||
RecursiveLocker _(&sLowResourceLock);
|
||||
|
||||
compute_state();
|
||||
state = low_resource_state_no_update(B_ALL_KERNEL_RESOURCES);
|
||||
int32 state = low_resource_state_no_update(B_ALL_KERNEL_RESOURCES);
|
||||
|
||||
TRACE(("low_resource_manager: state = %ld, %ld free pages, %lld free "
|
||||
"memory, %lu free semaphores\n", state, vm_page_num_free_pages(),
|
||||
@@ -265,7 +262,7 @@ low_resource_manager(void*)
|
||||
|
||||
call_handlers(sLowResources);
|
||||
|
||||
if (state == B_LOW_RESOURCE_WARNING)
|
||||
if (state >= B_LOW_RESOURCE_WARNING)
|
||||
timeout = kWarnResourceInterval;
|
||||
else
|
||||
timeout = kLowResourceInterval;
|
||||
|
||||
Reference in New Issue
Block a user