[haiku-bugs] Re: [Haiku] #16622: kernel: system_info.used_pages don't include mapped files

  • From: "Haiku" <trac@xxxxxxxxxxxx>
  • To: undisclosed-recipients: ;
  • Date: Sun, 29 Nov 2020 13:42:35 -0000

#16622: kernel: system_info.used_pages don't include mapped files
----------------------------+----------------------------
  Reporter:  X512           |      Owner:  nobody
      Type:  bug            |     Status:  new
  Priority:  normal         |  Milestone:  Unscheduled
 Component:  System/Kernel  |    Version:  R1/Development
Resolution:                 |   Keywords:
Blocked By:                 |   Blocking:
  Platform:  All            |
----------------------------+----------------------------
Description changed by X512:

Old description:

This is hrev54741.

As discussed [https://discuss.haiku-os.org/t/app-server-font-cache-is-
causing-high-cpu-load-in-low-resource-manager-thread-and-cause-
mysterious-resource-exhaustment/10147/13 here], mapping files to read-
only areas almost not affect `system_info.used_pages` that is used by
most memory inspecting utilities, but it actually consumes memory and
make allocations not possible if too many files are mapped.
`system_info.needed_memory` provides correct information about free
memory but is also seems to include disk cache that can be freed to
release memory for allocations.

If memory mapped files are consuming memory, they should be included in
`system_info.used_pages`.

Actually it is not required to reserve memory for read-only mapped files
because it can be handled in similar way as disk cache: load file
contents on demand and unload when memory is needed by someone else. This
approach do not violate no overcommit policy. If program change area
protection and enable copy-on-write, attempt may failed with out of
memory if memory can't be reserved.

New description:

 This is hrev54741.

 As discussed [https://discuss.haiku-os.org/t/app-server-font-cache-is-
 causing-high-cpu-load-in-low-resource-manager-thread-and-cause-mysterious-
 resource-exhaustment/10147/13 here], mapping files to read-only areas
 almost not affect `system_info.used_pages` that is used by most memory
 inspecting utilities, but it actually consumes memory and make allocations
 not possible if too many files are mapped. `system_info.free_memory`
 provides correct information about free memory but is also seems to
 include disk cache that can be freed to release memory for allocations.

 If memory mapped files are consuming memory, they should be included in
 `system_info.used_pages`.

 Actually it is not required to reserve memory for read-only mapped files
 because it can be handled in similar way as disk cache: load file contents
 on demand and unload when memory is needed by someone else. This approach
 do not violate no overcommit policy. If program change area protection and
 enable copy-on-write, attempt may failed with out of memory if memory
 can't be reserved.

--
-- 
Ticket URL: <https://dev.haiku-os.org/ticket/16622#comment:2>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: