whether the pages where mapped. Was introduced already in r22731.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35532 a95241bf-73f2-0310-859d-f6bbb57e9c96
needs to be or'ed to the address specification), "uncached" is assumed.
* Set the memory type for the "BIOS" and "DMA" areas to write-back. Not sure, if
that's correct, but that's what was effectively used on my machines before.
* Changed x86_set_mtrrs() and the CPU module hook to also set the default memory
type.
* Rewrote the MTRR computation once more:
- Now we know all used memory ranges, so we are free to extend used ranges
into unused ones in order to simplify them for MTRR setup.
- Leverage the subtractive properties of uncached and write-through ranges to
simplify ranges of any other respectively write-back type.
- Set the default memory type to write-back, so we don't need MTRRs for the
RAM ranges.
- If a new range intersects with an existing one, we no longer just fail.
Instead we use the strictest requirements implied by the ranges. This fixes
#5383.
Overall the new algorithm should be sufficient with far less MTRRs than before
(on my desktop machine 4 are used at maximum, while 8 didn't quite suffice
before). A drawback of the current implementation is that it doesn't deal with
the case of running out of MTRRs at all, which might result in some ranges
having weaker caching/memory ordering properties than requested.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35515 a95241bf-73f2-0310-859d-f6bbb57e9c96
therefore does not unlock anymore while iterating over the transactions.
This gave other threads the opportunity to finish a transaction, causing
bug #5412. Also, the BlockWriter will now always close transactions on its
own, and you need to pass the transaction hash iterator to Add().
* Also, transactions that contain blocks that are currently written back will
be ignored by the block writer, as well as cache_sync_transaction(). This
fixes bug #5415.
* Improved error handling if BlockWriter fails to write back blocks. Most
notably, they are no longer left busy_writing, and the functions calling
it do proper error reporting (besides block_cache_discard() that does not
return any erro code; I've added a TODO note there for now).
* The BlockWriter now starts with a larger array once it has to allocate one.
* One can now limit the number of blocks that go into a BlockWriter. This is
used by the block writer thread, that shouldn't always write back everything
every two seconds.
* Also, the fixed array is larger now (leaving enough space such that the
block writer/notifier does not need to allocate anything).
* And finally, if allocating the array fails, the BlockWriter falls back to the
synchronous write back used previously. IOW it will never write back less
blocks than you ask for.
* Added static BlockWriter::WriteBlock() method replacing write_cached_block().
* Forgot to rename block_cache::busy_count to busy_reading_count.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35510 a95241bf-73f2-0310-859d-f6bbb57e9c96
arch_timer_set_hardware_timer(). This was harmless, at least with our
current x86 timers implementation, since they checked for minimum timeouts.
Very small cleanup (now that the file is compiled as C++).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35505 a95241bf-73f2-0310-859d-f6bbb57e9c96
particular it wouldn't set the flag when writing something to a page, but
only move it to the modified queue. Since mapping the page would move it to
another queue, the information that the page was modified would be lost and
it would never be written to disk. Was well reproducible with a Haiku image
build and limited amount of memory.
Fixes the hopefully last remaining cause for #5374.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35500 a95241bf-73f2-0310-859d-f6bbb57e9c96
* full_scan_inactive_pages(): Fixed syntactical glitch (missing "else").
Affected only the active paging mode and was relatively harmless. The worst
case would be that an inactive page would be moved to the cached queue
although its usage_count hadn't dropped to 0 yet, thus freeing it before
pages that deserved it more.
* move_page_to_active_or_inactive_queue():
- Was ignoring the page's modified flag, thus potentially moving a modified
page to the cached queue. That could happen only in rare cases though,
like when the page was still mmap()ped while being written and modified and
unmapped before being done.
- No longer move the page to the inactive queue, even if its usage count is 0.
In idle mode the page daemon doesn't look at inactive pages, so the page's
stats wouldn't be updated anymore.
- Renamed to move_page_to_appropriate_queue().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35499 a95241bf-73f2-0310-859d-f6bbb57e9c96
inactive pages to the active queue. This has the advantage that the page
daemon will keep track of those pages even in idle mode (where it only
processes the active queue).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35498 a95241bf-73f2-0310-859d-f6bbb57e9c96
block_cache_discard() use the BlockWriter directly as well.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35496 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Added new KDL command "cached_block" that dumps a cached block.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35493 a95241bf-73f2-0310-859d-f6bbb57e9c96
to make the guard page inaccessible. Thanks Ingo for the pointer!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35488 a95241bf-73f2-0310-859d-f6bbb57e9c96
* vm_page_write_modified_page_range(): Need to DEBUG_PAGE_ACCESS_END() a bit
later.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35487 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Use the same criterion when to write back temporary pages as the page daemon.
* Move wired and temporary pages that shall not be written back to the active or
inactive queue so they don't get stuck in the modified queue and potentially
cause the page writer to run permanently without actually making progress
(#5382).
page writing implementation:
* If writing back a temporary page failed, move it back to the inactive or
active queue, so it doesn't get stuck in the modified queue. If active paging
continues, it might find its way back to the modified queue in the next
iteration, but that improves the situation a bit at least. Particularly with
the port heap pages not really being swappable ATM.
* Never dequeue pages from the modified queue. We mark them busy, so the page
writer will skip them anyway. This allows others to play with the page to some
extend (at least allowing to move it between the queues). This fixes#5404.
* Removed PageWriteWrapper::ClearModifiedFlag(). We clear the modified flag in
PageWriteWrapper::SetTo(), now, so that the page writer doesn't need to do
that explicitly either.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35485 a95241bf-73f2-0310-859d-f6bbb57e9c96
the heap debug panics. Instead syslog output is generated if turned off.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35481 a95241bf-73f2-0310-859d-f6bbb57e9c96
well as the thread allocating it. Can for example be used to verify that an
object or buffer is as large as expected.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35480 a95241bf-73f2-0310-859d-f6bbb57e9c96
keeping all returned heap memory in the 0xdeadbeef state (including the
first sizeof(void *) bytes otherwise for the free list). While wasting a lot
of memory it allows you to rely on 0xdeadbeef being always present as no
future allocation will reuse the freed memory block.
* Also added heap_debug_malloc_with_guard_page() which is intended to allocate
a memory block so it is aligned that the start of invalid memory past the
allocation is in an unmapped guard page. However the kernel backend that would
guarantee this is not yet implemented, so right now this works only by chance
if no other area happens to be allocated exactly past the created one. With a
very specifc suspicion you can put that one allocation you get to good use
though. It causes a crash when accessing memory past the allocation size so
you actually get a backtrace from where the access happened instead of only
after freeing/wall checking.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35478 a95241bf-73f2-0310-859d-f6bbb57e9c96
it has been unmapped. This way modified pages could end up in the "cached"
queue without having been written back. That would be a good explanation for
#5374 (partially wrong file contents) -- as soon as such a page was freed,
the invalid on-disk contents would become visible.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35477 a95241bf-73f2-0310-859d-f6bbb57e9c96
so the fallback implementations of UnmapPages() and UnmapArea() need to do
that. Not relevant for x86.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35476 a95241bf-73f2-0310-859d-f6bbb57e9c96
though).
* Added/improved some KDL commands to make the slab easier to work with from
KDL.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35466 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Renamed the "busy" stuff to "busy_reading", and added a "busy_writing"
concept.
* This now allows reading a block (and other blocks), while blocks are written
back. This should speed all operations needing to write back blocks, like
unzipping or compiling.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35464 a95241bf-73f2-0310-859d-f6bbb57e9c96
driver_events (ie. there is now only a single list to walk).
* Also, the DriverWatcher is now maintained using the driver_events.
This fixes bug #5005.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35463 a95241bf-73f2-0310-859d-f6bbb57e9c96
call with the true parameter. Fixes a panic at boot when using the hpet timers
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35453 a95241bf-73f2-0310-859d-f6bbb57e9c96
which happened on some systems (mine included).
Should close ticket #5341.
Thanks!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35441 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Moving some functions around, removing and adding others for the public API.
I've written a blog post at haiku-os.org to go as documentation for this
introducing the API and the other helpful bits.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35431 a95241bf-73f2-0310-859d-f6bbb57e9c96
the contiguous page allocation function and unlocks a bin locker a bit earlier.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35424 a95241bf-73f2-0310-859d-f6bbb57e9c96
* Make the contiguous page allocation capable of aligning the allocation
and make it more clever by checking up front if there's a chance of getting
enough pages at all, by giving up earlier if the page count can't be fit
anymore, and in the alignment case by only checking the pages which have a
valid alignment.
* If the alignment requirement is > B_PAGE_SIZE we now use page allocation
directly, because the bins aren't necesarily aligned on their size past
B_PAGE_SIZE anymore.
* When doing aligned bin allocation, calculate the aligned size up front and
choose the right heap for the allocation.
* Also when doing aligned bin allocations we not only need to round up the size
but also ensure that the bin we choose is aligned at all.
* Moved adding leak check info into it's own function.
Fixes various misalignment problems when working with alignments > B_PAGE_SIZE
or when using alignments < allocation size. Also the directly aligned page
allocations now only use up as many pages as actually required instead of
allocating based on the rounded up to align size.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35422 a95241bf-73f2-0310-859d-f6bbb57e9c96
consider that when filling in the text and data ranges of the image info.
This fixes#5361 and #5351, caused by libtracker.so not finding its own
image.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35407 a95241bf-73f2-0310-859d-f6bbb57e9c96