[haiku-commits] r37140 - haiku/trunk/src/system/kernel

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 15 Jun 2010 02:06:19 +0200 (CEST)

Author: bonefish
Date: 2010-06-15 02:06:19 +0200 (Tue, 15 Jun 2010)
New Revision: 37140
Changeset: http://dev.haiku-os.org/changeset/37140/haiku

Modified:
   haiku/trunk/src/system/kernel/low_resource_manager.cpp
Log:
* compute_state(): Fixed computation of the low resource state for the address
  space (missing elses). The state would never get higher than "note". There
  still seems to be an issue (probably vm_kernel_address_space_left() not
  returning the correct value), since even at 2021 MB (as reported by "aspaces")
  the state is still only "note", while the heap grower is not able to allocate
  heap areas anymore.
* "low_resource" command: The address space flag was not printed for hooks.


Modified: haiku/trunk/src/system/kernel/low_resource_manager.cpp
===================================================================
--- haiku/trunk/src/system/kernel/low_resource_manager.cpp      2010-06-14 
23:59:38 UTC (rev 37139)
+++ haiku/trunk/src/system/kernel/low_resource_manager.cpp      2010-06-15 
00:06:19 UTC (rev 37140)
@@ -181,13 +181,13 @@
        size_t maxSpace = KERNEL_SIZE;
        size_t freeSpace = vm_kernel_address_space_left();
 
-       if (freeSpace < maxSpace >> 16)
+       if (freeSpace < maxSpace >> 16) {
                sLowSpaceState = B_LOW_RESOURCE_CRITICAL;
-       if (freeSpace < maxSpace >> 8)
+       } else if (freeSpace < maxSpace >> 8) {
                sLowSpaceState = B_LOW_RESOURCE_WARNING;
-       if (freeSpace < maxSpace >> 4)
+       } else if (freeSpace < maxSpace >> 4) {
                sLowSpaceState = B_LOW_RESOURCE_NOTE;
-       else {
+       } else {
                sLowSpaceState = B_NO_LOW_RESOURCE;
                sLowResources &= ~B_KERNEL_RESOURCE_ADDRESS_SPACE;
        }
@@ -272,10 +272,11 @@
                        &symbol, NULL, NULL);
 
                char resources[16];
-               snprintf(resources, sizeof(resources), "%c %c %c",
+               snprintf(resources, sizeof(resources), "%c %c %c %c",
                        handler->resources & B_KERNEL_RESOURCE_PAGES ? 'p' : ' 
',
                        handler->resources & B_KERNEL_RESOURCE_MEMORY ? 'm' : ' 
',
-                       handler->resources & B_KERNEL_RESOURCE_SEMAPHORES ? 's' 
: ' ');
+                       handler->resources & B_KERNEL_RESOURCE_SEMAPHORES ? 's' 
: ' ',
+                       handler->resources & B_KERNEL_RESOURCE_ADDRESS_SPACE ? 
'a' : ' ');
 
                kprintf("%p  %p   %s      %4ld  %s\n", handler->function, 
handler->data,
                        resources, handler->priority, symbol);


Other related posts:

  • » [haiku-commits] r37140 - haiku/trunk/src/system/kernel - ingo_weinhold