Commit Graph

25173 Commits

Author SHA1 Message Date
Ingo Weinhold
b8a6621507 fault_find_page(): When the source of the top cache is busy, we may
find our own dummy page. This is equivalent to not finding a page at
all. Fixes #2471.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26248 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-04 15:46:27 +00:00
Ingo Weinhold
063a092f93 Test to quickly reproduce bug #2471.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26247 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-04 15:20:43 +00:00
Michael Lotz
af637076ad * Avoid calling vm_unreserve_memory() if there is no change in the commited
size. Removes a bit of overhead (call and mutex_lock / mutex_unlock).
* Don't fail if there is exactly enough memory available to satisfy the
  reserve request. Not that it would really matter as it's rather an edge case...

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26246 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-04 14:49:25 +00:00
Michael Lotz
45b309e39d Spotted this while reading through page code. The usage_count would be set for
wrong pages when allocating a page run unless the run started at page 0 as the
start offset was missing.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26245 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-04 14:41:17 +00:00
Michael Lotz
e511f726ea * Implement freeing of empty heap areas. When a heap_area becomes completely
empty and there is another empty area already, it is now removed from the
  heap and the underlying area is deleted.
* Fix grow suggestions to be based on 20% of a grow size instead of 10% of the
  current page count, as the current page count obviously gets larger over time
  making 10% of it larger than the grow size itself.
* Fix non-urgent grow request handling so that not two areas at once get added.
* Made some of the debug output more useful, turned off some other and fixed
  some comments.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26244 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-03 22:57:27 +00:00
Ingo Weinhold
71dffe8b84 The stack layout changed in r23983. Since then user_debug_post_syscall()
wouldn't be passed the syscall start time anymore. Fixes weird syscall
timings when using strace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26243 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-03 21:14:54 +00:00
Axel Dörfler
dcdf3137e1 * Unnamed volumes now get the disk size instead of "unnamed" in their mount
menu name, ie. "(unnamed Ext2 File System)" could become "(12.5 GB Ext2 File System)".
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26242 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-03 20:44:57 +00:00
Axel Dörfler
c4d5cef0c6 * Now prints the disk size as part of the default name so that different
volumes are easier to differentiate.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26241 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-03 20:41:31 +00:00
Ingo Weinhold
dc27129332 stippi + bonefish:
* Missing backslash in UPDATE_THREAD_KERNEL_TIME() macro. Caused the
  thread's kernel time never to be updated when the thread left the
  kernel. The time would be added to the user time instead.
* Changed semantics of thread_at_kernel_exit(). It leaves interrupts
  disabled when returning, now. All code using it would disable
  interrupts afterwards anyway, and inbetween the thread could be
  interrupted causing two more time updates (or actually not causing
  them erroneously).
* The code in x86's interrupt handler entry (int_bottom) also checks
  thread::in_kernel now, to determine whether the thread was already
  considered to be in userland. This is necessary since the sysexit
  instruction doesn't reenable interrupts, so that we have to do that
  with the preceeding instruction. Hence an interrupt can occur
  inbetween, which would incorrectly add the interrupt's kernel time
  to the thread's user time.
* For userland threads team_create_thread_start() didn't invoke
  thread_at_kernel_exit() or any equivalent. We do that in 
  arch_thread_enter_userspace() now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26240 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-03 20:37:08 +00:00
Axel Dörfler
0875ae984f * Preparations for a module listener API - this will be used in the (disk)
device managers.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26239 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-03 11:52:36 +00:00
Stephan Aßmus
9380c00233 Tweaked the default preferred apps for some text mime types. The chances
are high that Pe is installed, if not, StyledEdit is used anyways. Also
Firefox is more likely to be present on these days images than NetPositive.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26238 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-03 11:36:28 +00:00
Michael Lotz
85ebbd1318 Another partial rewrite of the kernel heap. There are no heap lists anymore,
there is only one heap_allocator for each heap class. Instead of adding
complete allocators, individual areas can now be added to existing allocators.
This removes a lot of complexity in the frontend code and avoids the previous
duplications wasting resources (allocator lock, bin sizes, bin list).
The pages are now managed in heap_area structures that are attached to areas.
They store the page table, page free lists and local variables. The same
mechanism as used for heap_pages is now used for heap_areas too, i.e. they
are kept in a sorted list where the fullest but not yet completely full area
is always at the top. This favors areas to become completely full and other,
not as frequently used areas, to become completely empty over time so they can
be freed. Full areas are removed from the list, so they do not need to be
looked at/skipped when allocating new pages. Through this mechanism and as
there are no allocator lists anymore that grow bigger over time, allocations
should be far more scalable. Note that actually removing areas once they are
not needed anymore is still not implemented, but it is now a relatively easy
addition whereas previously it would have killed the whole design.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26237 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-03 01:44:35 +00:00
Axel Dörfler
bb956ce2ea * Fixed coding style.
* Since there is no "Haiku license", I replaced that with a reference to the
  MIT license as usual.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26236 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 22:03:04 +00:00
Oliver Ruiz Dorantes
625f6e7f92 Fix EOL, last one... sorry for the eolspam
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26235 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 21:32:59 +00:00
Oliver Ruiz Dorantes
43c93ca367 Fix EOL
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26234 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 21:26:41 +00:00
Oliver Ruiz Dorantes
d51d2501bf Fix EOL
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26233 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 21:18:43 +00:00
Oliver Ruiz Dorantes
75c310bc5b Fix EOL
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26232 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 21:12:07 +00:00
Oliver Ruiz Dorantes
ade530ec1d Fix EOL
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26231 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 21:10:24 +00:00
Oliver Ruiz Dorantes
5d7bf42195 Fix EOL
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26230 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 21:09:04 +00:00
Oliver Ruiz Dorantes
848c65ab3e Fix EOL
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26229 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 20:59:57 +00:00
Oliver Ruiz Dorantes
c8bc2d8897 Fix EOL
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26228 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 20:01:02 +00:00
Oliver Ruiz Dorantes
9bfe62f9aa Cleapups, Fix memory leaks,
Patch by Mika Lindqvist. Could we give give him Commit access? 
I am getting daily patches from him with fixes and new features.
 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26227 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 19:41:45 +00:00
Jérôme Duval
765ae3a785 Applied patch from Mika Lindqvist: This patch implements both strlwr() and strupr() functions in libroot and includes strupr() in kernel build.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26226 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 19:30:46 +00:00
Jérôme Duval
72401b8f9e PAGE_SIZE is defined in Haiku limits.h
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26225 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 19:13:13 +00:00
Oliver Ruiz Dorantes
b94e17518b Implement RemoteDevice contructor by String
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26224 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 18:28:00 +00:00
Stephan Aßmus
22e2241763 * Fixed a race condition where the interrupt for a command happened before
the thread issuing the command called acquire_sem_etc() on the semaphore
  that the interrupt handler would otherwise release. The semaphore is now
  released unconditionally, but to prevent the race condition that the
  B_RELEASE_IF_WAITING_ONLY was trying to avoid, it is released with the
  spinlock held.
* The error interrupt handler did not reset the fCommandsActive flag, but
  it seemed to us like it should do that.
* WaitForTransfer now also acquires the spinlock to reset fCommandsActive,
  which may be unnecessary but does not harm either.
* Cleanup of some long lines, sorry for mixing that with the actual fix.

Fixes bug #2359 (long pauses when accessing the disk).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26223 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 15:37:35 +00:00
Axel Dörfler
119b7dccf0 Patch by David Powell:
* Turn off text cursor when switching to text mode.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26222 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 15:04:10 +00:00
Michael Lotz
321ee820ea * Fix the broken size/alignment computations for area allocations by replacing
them with the ROUNDUP macro that was specifically made for this task so that
  too tired developers do not mess up the calculations...
* Don't use area allocation during kernel startup (not that it really happened).
* Minor simplification of similar calculations in heap_attach().

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26221 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 13:00:13 +00:00
Michael Lotz
84c54473eb Added grow request tracking again. In case an allocation fails due to lack of
contiguous pages, it will request growing even if there are still more than
10% free pages available. Previously that case was not handled anymore and the
allocation would have just failed. Note that this is a pretty rare case, as
there are no "large" allocations happening in either the small or large heap
classes, but only in the huge one for allocations between 128KB and 1MB.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26220 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 11:42:35 +00:00
Stephan Aßmus
96a152f90d Applied patch by Urias McCullough:
Fixed Big Endian build of ReiserFS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26219 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 11:20:47 +00:00
Axel Dörfler
bac6cc8ad7 * Fixed a few problems reported by Marcus - thanks for proofreading!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26218 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 10:38:27 +00:00
Axel Dörfler
3b83493b10 * Cast block before shifting, as suggested by Marcus; it shouldn't have any
actual consequences but looks more correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26217 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 10:33:38 +00:00
Michael Lotz
883f9063ef Implement transparent allocation by area for huge allocations (> 1MB). This
does in fact happen, as there are objects used in the kernel that allocate
with new, which in turn uses the heap. The OpenHashTable used from the slab
allocator hit this case during an svn checkout here, because it grows it's new
allocated list by doubling the list size. Added some unconditional debug
output for those cases to monitor the usage for now. All of that not yet really
tested though.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26216 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 10:29:02 +00:00
Michael Lotz
7431b5241e Fix subtle logic error that would always cause a needless large allocation if an alignment was given.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26215 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 09:50:58 +00:00
Axel Dörfler
b7cb8f8c30 * Seems like GCC4 does not like declaring structures inside unnamed unions;
that looks like a compiler bug to me, though.
* Pulled struct data_stream out of the union (now called ext2_data_stream),
  based on a patch by Maurice, thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26214 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 09:43:12 +00:00
Axel Dörfler
13de3d0767 * Fixed wrong group block offset computation: the
ext2_super_block::first_data_block must be used; the superblock offset
  doesn't matter if the block size is greater than 2KB.
* Fixed block access beyond the 4GB limit - we need to cast the block to
  a 64 bit type in ext2_get_file_map() before shifting it.
* Tested with various larger ext3 disks, and everything seems to work fine.
* Added some optional debug output.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26213 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 09:15:04 +00:00
Michael Lotz
0aad734230 The simple alignment trick used before doesn't work with the new heap classes
(it didn't really work previously anyway). The only alignment really used seems
to be B_PAGE_SIZE, which happened to always work out before, because anything
larger would have been allocated using individual pages anyway. Since larger
bins are now available and with kernel heap leak checking enabled an allocation
of B_PAGE_SIZE with B_PAGE_SIZE alignment is actually a bit bigger than
B_PAGE_SIZE, it got into the 5KB bin, which didn't guarantee the alignment
anymore. This would have caused a tripple fault on boot when kernel heap leak
checking was enabled. The alignment is now taken into account when picking
the bin for the allocation. Added a more detailed TODO as to why this isn't
the best thing (wastes space) and how it could be changed if deemed necessary.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26212 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-02 00:59:32 +00:00
Stephan Aßmus
396f6e29ee bonefish+stippi:
Implemented the needed fs API hooks to support identifying partitions 
(so ReiserFS partitions appear in the Tracker Mount menu now).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26211 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 23:54:08 +00:00
Michael Lotz
b1f4df4a62 Implement heap classes that each have their own range of allocation sizes they
serve, bin sizes and page size. This minimizes the amount of "large"
allocations made in heaps that don't have a bin for the allocation size
(combining multiple pages). This is desirable as such large allocations
are generally pretty inefficient, and also because it separates larger from
smaller allocations better, making the chance of a heap becoming empty higher.
For now there are three heap classes "small", "large" and "huge", with a
predefined set of bin sizes for each. This might need some finetuning later on.
Reduce the grow size to 4MB though as the allocations should now be spread
across heap classes which each grow on their own.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26210 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 23:19:35 +00:00
Stephan Aßmus
e8679dcdc7 Merge Ingo's reiserfs changes which he accidentally commited to his branch: Adopted reiserfs add-on to the new fs API and added it to the image.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26209 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 22:46:54 +00:00
Marcus Overhagen
d7c321236f Set transfer length when doing ATAPI transfers.
Dump ATAPI command packet on error.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26205 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 22:04:33 +00:00
Jérôme Duval
af206cf2d6 gcc4 build fix
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26204 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 20:56:23 +00:00
Michael Lotz
8c57aefdf8 Remove the B_PAGE_SIZE page size and replace it by a heap->page_size. This
allows for dynamic (heap)page sizes. It's currently just set to B_PAGE_SIZE
but I'm expermienting with the creation of differently sized heaps that could
use dynamic page sizes with that.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26203 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 20:44:43 +00:00
Oliver Ruiz Dorantes
b42c202a65 Fix typos reported by Mika, and remove whitespaces
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26202 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 20:28:12 +00:00
Oliver Ruiz Dorantes
d0651ae6ac Add entity to handle the available LocalDevices from KL
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26201 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 20:25:08 +00:00
Michael Lotz
86a38aedf4 Take a shortcut when freeing in heap_realloc(), we already know the address belongs to our heap.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26200 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 20:18:02 +00:00
Oliver Ruiz Dorantes
291e114333 Fix EOL
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26199 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 19:43:37 +00:00
Oliver Ruiz Dorantes
480cccf67b Fix a serious TODO,
Report the index where the event opcode pair has been found.
Currently server was expecting them to be the first entry of the request 



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26198 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 19:35:10 +00:00
Michael Lotz
5c5b7a5760 While the comment was correct with regards to collecting the semaphore after
the cancel, it wasn't actually done. This could bring a device out of sync in
the case timeouts actually happened (which shouldn't be a commen case).
Fixed that and increased the timeout to 2 seconds in favor of slower devices.
Might need some fine tuning later still.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26197 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 19:21:59 +00:00
Oliver Ruiz Dorantes
18dbcd22a0 Handle the command status sent before the arrival of a remote name request.
Avoid unhandled event in the bluetooth_server
	by Mika Lindqvist
  


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26196 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-01 19:15:15 +00:00