[haiku-commits] haiku: hrev53334 - src/system/kernel

  • From: Ryan Leavengood <leavengood@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 2 Aug 2019 22:20:00 -0400 (EDT)

hrev53334 adds 1 changeset to branch 'master'
old head: 47df2afbf848b56bd873a4b4f201b49b8080cdf8
new head: 6cb38c63195a275a7a65b4fb79499586ead07432
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=6cb38c63195a+%5E47df2afbf848

----------------------------------------------------------------------------

6cb38c63195a: 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.

                                   [ waddlesplash <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53334
Commit:      6cb38c63195a275a7a65b4fb79499586ead07432
URL:         https://git.haiku-os.org/haiku/commit/?id=6cb38c63195a
Author:      waddlesplash <waddlesplash@xxxxxxxxx>
Date:        Sat Aug  3 01:59:24 2019 UTC
Committer:   Ryan Leavengood <leavengood@xxxxxxxxx>
Commit-Date: Sat Aug  3 02:18:56 2019 UTC

----------------------------------------------------------------------------

1 file changed, 4 insertions(+), 7 deletions(-)
src/system/kernel/low_resource_manager.cpp | 11 ++++-------

----------------------------------------------------------------------------

diff --git a/src/system/kernel/low_resource_manager.cpp 
b/src/system/kernel/low_resource_manager.cpp
index 55962db93d..87c49117e4 100644
--- a/src/system/kernel/low_resource_manager.cpp
+++ b/src/system/kernel/low_resource_manager.cpp
@@ -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;


Other related posts: