* Removed private AutoDeleter class. The shared ArrayDeleter is used instead.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22538 a95241bf-73f2-0310-859d-f6bbb57e9c96
to create their mode list. Once it's done, it should cover all possible cases,
and allow the base mode list to reside in the app_server (under Haiku, at least),
so that all drivers will benefit from an updated list.
Right now, it might already work to a degree, but it's not yet tested.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22517 a95241bf-73f2-0310-859d-f6bbb57e9c96
can be used (and is, by _init_interface_kit()) to initialize the ...
er... default instance of
PaletteConverter using the system color map, thus avoid building the
list of colors, which takes some time. Fixes bug #505.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22508 a95241bf-73f2-0310-859d-f6bbb57e9c96
vm_page_reserve_pages() and vm_page_allocate_page() will now steal pages from
the inactive queue as needed.
* We currently never steal active pages anymore, but this might need to be
revised later (therefore, the page scanner never waits anymore, but uses
mutex_trylock() to lock a cache).
* The page scanner and writer now both run at normal priority - let's see how
that will work out.
* Introduced an inactive queue.
* Instead of shuffling pages around in the queue (and therefore destroying LRU)
the page stealing mechanism now uses a marker page to be able to release the
page lock without losing its position in the queue.
* The page writer now always grabs the whole release count of the semaphore, so
that there won't be a huge backlog to catch up with.
* vm_page_num_free_pages() now also includes the inactive queue as well as the
reserved pages (they are no longer regarded as free pages).
* Added a insert_page_after() function that inserts a page after another one,
needed by the marker code.
* clear_page() now gets a vm_page instead of a physical address which simplified
some code.
* Removed superfluous initialization of the queues (if those aren't zeroed on
start, we would have serious problems, anyway).
* Removed old and unimplemented dump_free_page_table() ("free_pages") KDL
command.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22506 a95241bf-73f2-0310-859d-f6bbb57e9c96
it intended to. That resulted in more writable pages where you wouldn't want
them (ie. allowing the area to change pages in lower caches).
* We were losing modified pages: vm_unmap_pages() sometimes has to preserve
the modified flag (eg. when called from page fault).
* Both of these were responsible that stealing active pages would crash
applications - even if less likely, this could also have happened when
stealing inactive pages. Therefore, I've activated stealing active pages
again.
* The page writer now pushes the pages of busy vnodes to the end of the queue,
so that it won't pick them up again too soon (the vnode destruction would
be in the process of writing those pages back, anyway).
* The page thief now triggers the page writer to run once it has to steal
active pages. This might be a bit too aggressive, though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22495 a95241bf-73f2-0310-859d-f6bbb57e9c96
busy vnodes.
* dir_create_entry_ref() used get_vnode() incorrectly (and could therefore
potentially prevent a file system from doing proper locking when called
from the kernel).
* The vnode_store now uses this for its acquire_unreferenced_ref()
implementation (and therefore for the page writer).
* read_into_cache() and write_to_cache() were still marked inline.
* The system will now wait 10 secs for a busy vnode before returning an error.
* It will also no longer panic in that case.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22485 a95241bf-73f2-0310-859d-f6bbb57e9c96
functionality of the kernel add-ons will be moved into userland, which
will simplify the kernel-side significantly.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22481 a95241bf-73f2-0310-859d-f6bbb57e9c96
additional partition_data* child parameter now.
* _user_get_partitionable_spaces() doesn't need to copy the buffer into
the kernel, since it is no input parameter. It also copies back the
actual partitionable spaces count on error, now -- B_BUFFER_OVERFLOW
is returned when the buffer was too small, but then the count must be
returned too.
* Fixed several instances of syscall implementations that unloaded a disk
system, although they didn't load it in the first place. This screwed
up the load count with undesirable consequences.
* _user_create_child_partition() would set the size to the supplied
offset.
* Fixed broken loop in KPhysicalPartition::CreateShadowPartition().
* KPartition::RemoveChild() notified the listeners about the wrong
event.
* Intel partitioning module:
- The *_get_partitionable_spaces() correctly return B_BUFFER_OVERFLOW
now, if the supplied buffer is too small.
- Implemented a part of pm_shadow_changed(), which creates and updates
the PartitionMap, so that the validate_*() hooks have a chance to
work at all.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22475 a95241bf-73f2-0310-859d-f6bbb57e9c96
BPartition structure with the data retrieved from the kernel. For new
partitions the field is not set in the next step and later code would
use an initialized pointer.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22471 a95241bf-73f2-0310-859d-f6bbb57e9c96
* his has to be used by the page writer to make sure the vnode is still valid.
* This should have been the final nail on the Luposian bug - I haven't tested
it yet, but we'll certainly see :-)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22462 a95241bf-73f2-0310-859d-f6bbb57e9c96
interfere with the page thief, we always need to have reserved a page for
this upfront. I introduced a function to the vm_translation_map layer that
estimates how much pages a mapping might need at maximum. All functions that
map a page now call this and reserve the needed pages upfront.
It might not be a nice solution, but it works.
* The page thief could run into a panic when trying to call vm_cache_release_ref()
on a non-existing (NULL) cache.
* Also, it will now ignore wired active pages.
* There is still a race condition between the page writer and the vnode
destruction - writing a page back needs a valid vnode, but that might just
have been deleted.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22455 a95241bf-73f2-0310-859d-f6bbb57e9c96
system initialize() hooks. It's often the only info about the
partition one needs and thus locking the partition just to get it is
no longer necessary.
* intel partitioning system:
- Removed passing around block sizes. We require 512 byte sectors
anyway. In fact using the parent partition's block size was even
wrong.
- Simplified writing the partition map sector.
- Simplified and corrected the partition map initialization.
- We don't fail identifying a partition anymore, if the partition map
contains no partitions. We would never identify a freshly
initialized partition map before.
- Made pm_identify() more intelligent: It determines the priority to
return depending on whether the partition is the device itself and
whether we have recognized child partitions.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22447 a95241bf-73f2-0310-859d-f6bbb57e9c96
does no longer give partitioning systems precedence over file systems.
The one with the greater identification priority wins. ATM, if a file
system wins, we still mount the first file system that recognized the
partition at all, though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22446 a95241bf-73f2-0310-859d-f6bbb57e9c96
the unmapped page.
* This is needed by everyone who calls this to make sure modifications to a
page aren't ignored. Namely, the page scanner and the page thief were
affected.
* Cleaned up locking the page's cache a bit in page_thief(); there is now
a helper class that takes care of everything.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22438 a95241bf-73f2-0310-859d-f6bbb57e9c96
* the page writer don't allow to block, while all other writers do. This fixes
bug #1509. The reason the page writer needs this is because it marks several
pages from different caches as busy.
* Fixed a warning about ASSERT being defined already in BFS, since
util/DoublyLinkedList.h now includes debug.h.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22434 a95241bf-73f2-0310-859d-f6bbb57e9c96
dprintf() with the exception that it doesn't write anything to the
syslog. The reason is that syslog_write() releases a semaphore and can
therefore not be invoked when the thread spinlock is held.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22428 a95241bf-73f2-0310-859d-f6bbb57e9c96
vfs_select.h, respectively moved most of it into the new kernel
private header wait_for_objects.h.
* Added new experimental API functions wait_for_objects[_etc](). They
work pretty much like poll(), but also for semaphores, ports, and
threads.
* Removed the "ref" parameter from notify_select_events() and the
select_sync_pool functions as well as from fd_ops::fd_[de]select(). It
is no longer needed. The FS interface select() hook still has it,
though -- the VFS will always pass 0.
* de]select_fd() take a select_info* instead of a select_sync* + ref
pair, now. Added respective functions for semaphores, ports, and
threads.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22416 a95241bf-73f2-0310-859d-f6bbb57e9c96
and thread spinlock was reverse in Wait() and Notify(). The thread lock
is now the outer lock -- this way it is still possible to call Notify()
with the thread lock being held.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22401 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Reworked the select support:
- The io_context additionally stores a table of lists of select_infos,
which enables it to deselect events of a pending select() when
closing a FD. This prevents a race condition potentially causing a
write to stale memory.
- The opaque selectsync* passed to FSs is now actually a select_info*.
This was necessary, since the FDs deselect() hook (unlike the
select() hook) doesn't take a "ref" argument and deselecting a
single info (e.g. caused by a premature close()) was not possible.
The select() hook's "ref" argument has become superfluous.
- It should now be relatively easy to implement a poll_on_steroids()
that can also wait for objects other than FDs (e.g. semaphores,
ports, threads etc.).
* Set/reset the signal mask in common_select(). This makes pselect()
work as required.
* Reorganized vfs_resize_fd_table().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22391 a95241bf-73f2-0310-859d-f6bbb57e9c96
components - now, we divide the initialization of that service into two parts
which allows this (before, most handlers were gone after boot).
* Added debugger command that dumps the low memory handlers.
* The slab allocator now registers its low memory handler with a higher
priority, so that it'll run before the potentially heavier ones.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22374 a95241bf-73f2-0310-859d-f6bbb57e9c96
* 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
arguments into vm.h.
* This should fix the broken build from earlier - thanks Stefano for the note!
* That also allowed to clean some other includes a bit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22331 a95241bf-73f2-0310-859d-f6bbb57e9c96
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
opaque types for C.
* As a result, I've renamed some more source files to .cpp, and fixed
all warnings caused by that.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22326 a95241bf-73f2-0310-859d-f6bbb57e9c96
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
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
* Removed the vm_cache/vm_store ref_count duality that besides being a bit ugly
also created the page dameon cache retrieval problem: now, only areas (and
cache consumers) retrieve a reference to the store (and therefore, the vnode).
The page daemon doesn't need to care about this at all anymore, and the pseudo
references of the vm_cache could be removed again.
* Rearranged deletion of vnodes such that its ID can be reused directly after
fs_remove_vnode() has been called.
* vm_page_allocate_page() no longer panics when it runs out of pages, but just
waits for new pages to become available using the new sFreeCondition condition
variable - to make sure this happens in an acceptable time frame, it'll
trigger a run of the low memory handlers.
* Implemented a page_thief() that steals inactive pages from caches and puts
them into the free queue. It runs as a low memory handler.
* The file cache now sets the usage count on the pages it inserts into the
cache (needs some rework though, cache_io() doesn't do it yet).
* Instead of panicking, the kernel will currently dead lock in low memory
situations, since BFS does a bit too much in bfs_release_vnode().
* Some minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22315 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Replaced release_sem() with release_sem_etc() for future addition of the
B_DO_NOT_RESCHEDULE flag.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22308 a95241bf-73f2-0310-859d-f6bbb57e9c96
* 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