Commit Graph

20 Commits

Author SHA1 Message Date
Axel Dörfler bcb71f00e8 * My last change to vm_page.cpp made an existing bug much more likely to
appear: when freeing a modified page, it wouldn't have a cache
  anymore, but set_page_state_nolock() depended on it.
* To work around this, I added a vm_page_free() function, which the
  caches that free modified pages have to call (but others may, too).
  It will correctly maintain the sModifiedTemporaryPages counter in case
  the cache has already been removed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23318 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-09 18:15:28 +00:00
Axel Dörfler a6778735f9 bonefish+axeld:
* We now have a page writer that takes some pages from the modified queue
  and writes it back every few seconds. It can be triggered by the page
  scanner to do that more often, though. That mechanism can be greatly
  improved once we have our I/O scheduler working.
* Removed vm_page_write_modified_page() again - it was all "eaten up" by
  the page writer.
* Reworked vm_page_write_modified_pages() a bit: it now uses
  vm_test_map_modification() and vm_clear_map_flags() instead of the
  iterating over all areas which wouldn't even work correctly.
  The code is much simpler now, too.
* You usually put something to the tail of a queue, and remove the contents
  from the head, not vice versa - changed queue implementation to reflect this.
* Additionally, there is now a enqueue_page_to_head() if you actually want the
  opposite.
* vm_page_requeue() allows you to move a page in a queue to the head or tail.
* Replaced vm_clear_map_activation() with vm_clear_map_flags() which allows
  you to clear other flags than PAGE_ACCESSED.
* The page scanner dumps now some arguments with each run.
* Removed the old disabled pageout_daemon() from NewOS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22348 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-28 15:50:26 +00:00
Axel Dörfler e6dc7903e4 * vm.h no longer includes vm_types.h - only those that actually need access
to the private VM types are including vm_types.h now.
* Removed vm_page, vm_area, vm_cache, and vm_address_space typedefs; it's
  cleaner this way, and the actual types are only used in C++ files now,
  anyway.
* And that caused changes in many files...
* Made commpage.h self-containing.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22329 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-27 12:21:33 +00:00
Axel Dörfler 8692ec023c * Renamed vm_page_write_modified() to vm_page_write_modifed_pages() and
introduced a new vm_page_write_modified_page().
* Resolved a TODO: vm_page_write_modified_pages() did not mark a to be
  written page busy but unlocked its cache which could let someone else
  steal that page in the mean time.
* Moved the logic when to move a page to the active or inactive queue to
  a new function move_page_to_active_or_inactive_queue().
* Moved page_state_to_string() to vm_page(); it's now also used by the
  "page" and "page_queue" KDL commands.
* Made the output of the "page_queue list" command more useful.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22323 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-26 20:19:51 +00:00
Axel Dörfler 8e0f884c71 * Since the page scanner and thief can work more effectively when no vm_caches
are locked, there is now a vm_page_reserve_pages() call to ensure upfront that
  there is a page for me when I need it, and may have locked some caches.
* The vm_soft_fault() routine now makes use of that feature.
* vm_page_allocate_page() now resets the vm_page::usage_count, so that the file
  cache does not need to do this in read_chunk_into_cache() and
  write_chunk_to_cache().
* In cache_io() however, it need to update the usage_count - and it does that
  now. Since non-mapped caches don't have mappings, the page scanner will punish
  the cache pages stronger than other pages which is accidently just what we
  want.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22319 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-26 17:42:25 +00:00
Axel Dörfler 8c657126cd * Removed unused vm_page::busy_{reading|writing} fields.
* Fixed vm_page_allocate_page_run(): it did not take the pageState into account,
  and would therefore return uninitialized memory (ie. B_CONTIGUOUS areas would
  contain garbage).
  Now, it stores if a page is cleared in a new vm_page::is_cleared field.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22306 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-25 15:04:29 +00:00
Axel Dörfler c6a7ff7a9f * The new vm_page_mappings weren't updated correctly in many cases.
* Added a comment to vm_remove_all_page_mappings() that shows that we need to
  change the mapping spinlock into a mutex.
* Pointed out some potential problems in the code.
* Added vm_page_at_index(), vm_clear_map_activation(), and vm_test_map_activation()
  in preparation of the page scanner rewrite.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20407 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-03-23 11:48:37 +00:00
Axel Dörfler 3eca858515 * Moved the early startup VM allocation functions from vm_page.c to vm.cpp.
* Renamed them, made everything static besides vm_allocate_early() (previous
  vm_alloc_from_kernel_args()) which now allows you to specify a different
  virtual than physical size, and therefore makes vm_alloc_virtual_from_kernel_args()
  superfluous (which isn't exported anymore, and is now called allocate_early_virtual()).
* Enabled printing a stack trace on serial output on team crash - it doesn't hurt
  for now, anyway.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20244 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-02-27 19:26:40 +00:00
Axel Dörfler 97e069713b Added a "reenter" parameter to the {read|write}_pages() functions to give file
systems a chance to know if they have locked already.
This fixes a locking problem in BFS where one thread tried to acquire two read
locks (where someone else trying to acquire a write lock would have caused a
dead lock).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17108 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-12 13:34:04 +00:00
Axel Dörfler db823da57e * Even though our current heap is a temporary solution, the heap size depends
now on the amount of memory installed in the system. Ie. if you have only
  128 MB the kernel heap will be only half in size.
* Minor cleanup in vm_page.c, renamed some variables to match our style guide.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16838 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-19 15:02:21 +00:00
Ingo Weinhold 3b36b30fef * Made vm_alloc_virtual_from_kernel_args() available to other kernel
parts, too. Fixed a potential overflow.
* The generic physical page mapper reserves the virtual address range
  for the IO space now, so that noone can interfere until an area has
  been created. The location of the IO space is no longer fixed; it
  didn't look to me like it was necessary for x86, and we definitely
  need to be flexible for PPC.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15855 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-01-07 17:37:21 +00:00
Axel Dörfler b1a248305b Minor cleanup, changed return type of page count functions (from addr_t to size_t,
as that's more correct).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13089 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-06-13 13:02:24 +00:00
Axel Dörfler 74b043d98d Removed execute property that was set accidently (since CVS days).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11896 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-18 01:50:45 +00:00
Axel Dörfler fafd79e5c1 Added a function to allocate a non-continuous page run.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10396 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-12-12 20:33:01 +00:00
Axel Dörfler 583e12c489 Added vm_page_write_modified() prototype.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10199 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-23 03:16:10 +00:00
Axel Dörfler ba44a1e8e1 Changed the way the stores commit their memory: there is no special handling
for temporary memory anymore, it's the store's responsibility to do that
correctly now, and that functionality is reached via the vm_cache using
vm_cache_set_minimal_commitment().
Therefore, the vm_store commit() function now returns a status instead of
the size that could be commited.
Replaced the max_commit mechanism with one that cares about the available
memory, stores can reserve and unreserve such memory. The anonymous_commit()
will now fail in case it could not reserve the needed amount of memory.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9777 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-03 17:24:41 +00:00
Axel Dörfler 67a53f72af - the arch_vm_translation_map.c exported functions now have the arch_ prefix
- the above file now also exports a function to finally complete the kernel's
  address space translation map after semaphores became available (was just
  not done before)
- renamed some functions, especially the *_init2() functions are now called
  like *_init_post_area() to indicate they are called after the area functionality
  became available
- removed the _struct suffix from certain structures
- fixed some return types
- added prototype for vm_free_unused_boot_loader_range() to be called by
  arch code.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9423 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-19 23:19:10 +00:00
Axel Dörfler 9f67399eea Made header C++ safe. Also replaced the old "addr" type with "addr_t".
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8866 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-09-06 21:49:38 +00:00
Axel Dörfler 564cba312e Some header work: removed unnecessary dependencies to stage2.h, fixed
some broken C++ export definitions, added missing licenses etc.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3152 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-05-03 16:03:26 +00:00
ejakowatz 52a3801208 It is accomplished ...
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-07-09 12:24:59 +00:00