Commit Graph

5671 Commits

Author SHA1 Message Date
Michael Lotz
c1502cf1b8 Add heap_debug_get_allocation_info() to retrieve the size of the allocation as
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
2010-02-15 20:57:52 +00:00
Michael Lotz
081ff2db28 * Add heap_debug_set_memory_reuse() which allows to disable memory reuse,
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
2010-02-15 20:28:15 +00:00
Axel Dörfler
755a1de8c1 * BReference no longer uses the deprecated API.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35460 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-14 22:22:17 +00:00
Siarzhuk Zharski
408a0aa2f1 Identification for "Intel(R) Core(TM) i7 CPU Q 720 @ 1.60GHz" added.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35450 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-11 06:41:13 +00:00
Artur Wyszynski
38ecc1a764 Added FreeBSD fenv implementation - tested with dmd port, seems that it works
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35437 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-09 06:09:28 +00:00
Artur Wyszynski
cee04e8074 Fixed various errors/warnings reported by cppcheck:
* memory leaks
* resource leaks
* added const's to getters
* removed a few reundant conditions


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35433 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-08 22:50:38 +00:00
Michael Lotz
f6a6245c89 * Adding malloc_debug.h that exposes the malloc_debug API.
* 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
2010-02-08 01:27:21 +00:00
Stephan Aßmus
a487da80ba * Make a BStatusBar comfortable to use without any text labels.
* In SetBarHeight(), use InvalidateLayout() when used with layout management.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35418 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-06 09:48:37 +00:00
Axel Dörfler
a28ad48075 * Added _SIZEOF_ADDR_IFREQ() macro as existing on FreeBSD.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35408 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-04 20:40:35 +00:00
Ingo Weinhold
40bb94819e * Removed useless return parameter from vm_remove_all_page_mappings().
* Added vm_clear_page_mapping_accessed_flags() and
  vm_remove_all_page_mappings_if_unaccessed(), which combine the functionality
  of vm_test_map_activation(), vm_clear_map_flags(), and
  vm_remove_all_page_mappings(), thus saving lots of calls to translation map
  methods. The backend is the new method
  VMTranslationMap::ClearAccessedAndModified().
* Started to make use of the cached page queue and changed the meaning of the
  other non-free queues slightly:
  - Active queue: Contains mapped pages that have been used recently.
  - Inactive queue: Contains mapped pages that have not been used recently. Also
    contains unmapped temporary pages.
  - Modified queue: Contains unmapped modified pages.
  - Cached queue: Contains unmapped unmodified pages (LRU sorted).
  Unless we're actually low on memory and actively do paging, modified and
  cached queues only contain non-temporary pages. Cached pages are considered
  quasi free. They still belong to a cache, but since they are unmodified and
  unmapped, they can be freed immediately. And this is what
  vm_page_[try_]reserve_pages() do now when there are no more actually free
  pages at hand. Essentially this means that pages storing cached file data,
  unless mmap()ped, no longer are considered used and don't contribute to page
  pressure. Paging will not happen as long there are enough free + cached pages
  available.
* Reimplemented the page daemon. It no longer scans all pages, but instead works
  the page queues. As long as the free pages situation is harmless, it only
  iterates through the active queue and deactivates pages that have not been
  used recently. When paging occurs it additionally scans the inactive queue and
  frees pages that have not been used recently.
* Changed the page reservation/allocation interface:
  vm_page_[try_]reserve_pages(), vm_page_unreserve_pages(), and
  vm_page_allocate_page() now take a vm_page_reservation structure pointer.
  The reservation functions initialize the structure -- currently consisting
  only of a count member for the number of still reserved pages.
  vm_page_allocate_page() decrements the count and vm_page_unreserve_pages()
  unreserves the remaining pages (if any). Advantages are that reservation/
  unreservation mismatches cannot occur anymore, that vm_page_allocate_page()
  can verify that the caller has indeed a reserved page left, and that there's
  no unnecessary pressure on the free page pool anymore. The only disadvantage
  is that the vm_page_reservation object needs to be passed around a bit.
* Reworked the page reservation implementation:
  - Got rid of sSystemReservedPages and sPageDeficit. Instead
    sUnreservedFreePages now actually contains the number of free pages that
    have not yet been reserved (it cannot become negative anymore) and the new
    sUnsatisfiedPageReservations contains the number of pages that are still
    needed for reservation.
  - Threads waiting for reservations do now add themselves to a waiter queue,
    which is ordered by descending priority (VM priority and thread priority).
    High priority waiters are served first when pages become available.
  Fixes #5328.
* cache_prefetch_vnode(): Would reserve one less page than allocated later, if
  the size wasn't page aligned.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35393 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-03 18:53:52 +00:00
Ingo Weinhold
2735cad982 Added missing include.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35392 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-03 18:47:07 +00:00
Ingo Weinhold
cf99b9ab60 Added VMCache::CacheRef() accessor.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35391 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-03 18:46:29 +00:00
Michael Lotz
5bc9fb9d24 * Replace the truncate_string() helper function with a new, simplified version.
* Remove no longer necessary support functions.
* The new version uses a single BString as input/output parameter and only
  modifies that one by removing non-fitting chars and inserting the ellipsis
  where appropriate, so avoids copying around bytes/chars/strings in a few
  places. It uses the new Chars functions of BString so also no need for manual
  multibyte handling.
* Adjusted the BFont and ServerFont usage of truncate_string() which are both
  simplified by using the single BString. It avoids a lot of temprary
  allocations and string copying. The char * version of BFont
  GetTruncatedStrings() now uses the BString version and not the other way
  around anymore which requires us to allocate temporary BString objects, it's
  not worse than before though.
* This fixes a bunch of problems with the previous functions like always
  prepending the ellipsis for B_TRUNCATE_BEGINNING, crashing on short enough
  widths, violating the width in the B_TRUNCATE_END case when the width was
  short enough, non-optimal truncation in a few cases and sometimes truncation
  where none would've been needed. Also fixes #4128 which was a symptom of the
  broken B_TRUNCATE_BEGINNING.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35381 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-01 18:43:03 +00:00
Ingo Weinhold
c2629ccc6a Patch by "Grey": Small optimization of arch_int_disable_interrupts_inline()
and arch_int_restore_interrupts_inline().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35377 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-01 08:55:44 +00:00
Michael Lotz
a5b7cbe331 Adding utf-8 aware version of most functions to BString. They are named after
the corresponding normal functions but have a "Chars" in the name like
"MoveCharsInto" or "AppendChars". Also added CountBytes() and CharAt().
This should make everyday string handling with multibyte strings a bit easier.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35371 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-02-01 04:20:01 +00:00
Adrien Destugues
859d808fb7 Also forgot this.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35367 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-31 21:22:25 +00:00
Ingo Weinhold
e65c400299 * Replaced the vm_page_allocate_page*() "pageState" parameter by a more
general "flags" parameter. It encodes the target state of the page -- so
  that the page isn't unnecessarily put in the wrong page queue first -- a
  flag whether the page should be cleared, and one to indicate whether the
  page should be marked busy.
* Added page state PAGE_STATE_CACHED. Not used yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35333 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-29 15:54:40 +00:00
Ingo Weinhold
72382fa629 * Removed the page state PAGE_STATE_BUSY and instead introduced a vm_page::busy
flag. The obvious advantage is that one can still see what state a page is in
  and even move it between states while being marked busy.
* Removed the vm_page::is_dummy flag. Instead we mark marker pages busy, which
  in all cases has the same effect. Introduced a vm_page_is_dummy() that can
  still check whether a given page is a dummy page.
* vm_page_unreserve_pages(): Before adding to the system reserve make sure
  sUnreservedFreePages is non-negative. Otherwise we'd make nonexisting pages
  available for allocation. steal_pages() still has the same problem and it
  can't be solved that easily.
* map_page(): No longer changes the page state/mark the page unbusy. That's the
  caller's responsibility.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35331 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-29 10:00:45 +00:00
Axel Dörfler
e054bfbf08 * Added missing IPv6 defines and in6addr_any, in6addr_loopback exports.
* This should get most IPv6 applications to link (they just can't open IPv6
  sockets yet, as the protocol is missing).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35326 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-28 09:55:41 +00:00
Ingo Weinhold
deee8524b7 * Introduced {malloc,memalign,free}_etc() which take an additional "flags"
argument. They replace the previous special-purpose allocation functions
  (malloc_nogrow(), vip_io_request_malloc()).
* Moved the I/O VIP heap to heap.cpp accordingly.
* Added quite a bit of passing around of allocation flags in the VM,
  particularly in the VM*AddressSpace classes.
* Fixed IOBuffer::GetNextVirtualVec(): It was ignoring the VIP flag and always
  allocated on the normal heap.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35316 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-27 12:45:53 +00:00
Jérôme Duval
7fd580914a * updated libjpeg to version 8, as the previous version on trunk didn't look like version 7, the merge wasn't usable. I modified jpeglib.h to have the JPEGTranslator built.
* added libjpeg to AboutSystem
* JPEGTranslator now uses the shared library libjpeg.so


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35312 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-27 01:57:51 +00:00
Ingo Weinhold
cff6e9e406 * The system now holds back a small reserve of committable memory and pages. The
memory and page reservation functions have a new "priority" parameter that
  indicates how deep the function may tap into that reserve. The currently
  existing priority levels are "user", "system", and "VIP". The idea is that
  user programs should never be able to cause a state that gets the kernel into
  trouble due to heavy battling for memory. The "VIP" level (not really used
  yet) is intended for allocations that are required to free memory eventually
  (in the page writer). More levels are thinkable in the future, like "user real
  time" or "user system server".
* Added "priority" parameters to several VMCache methods.
* Replaced the map_backing_store() "unmapAddressRange" parameter by a "flags"
  parameter.
* Added area creation flag CREATE_AREA_PRIORITY_VIP and slab allocator flag
  CACHE_PRIORITY_VIP indicating the importance of the request.
* Changed most code to pass the right priorities/flags.

These changes already significantly improve the behavior in low memory
situations. I've tested a bit with 64 MB (virtual) RAM and, while not
particularly fast and responsive, the system remains at least usable under high
memory pressure.
As a side effect the slab allocator can now be used as general memory allocator.
Not done by default yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35295 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-26 14:44:58 +00:00
Stephan Aßmus
7f2f2fa041 Remove the ucontext.h header again, until the whole SA_SIGINFO backend is
implemented fully in order not to fool ported software into believing this
API can be used.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35291 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-25 23:16:06 +00:00
Stephan Aßmus
1518a682f9 Patch by Andreas Faerber: Adding ucontext.h POSIX header. mcontext_h can be
typedef'd to the existing vregs type. Applies #5324. Thanks a lot!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35287 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-25 18:06:50 +00:00
Ingo Weinhold
b4e5e49823 MemoryManager:
* Added support to do larger raw allocations (up to one large chunk (128 pages))
  in the slab areas. For an even larger allocation an area is created (haven't
  seen that happen yet, though).
* Added kernel tracing (SLAB_MEMORY_MANAGER_TRACING).
* _FreeArea(): Copy and paste bug: The meta chunks of the to be freed area
  would be added to the free lists instead of being removed from them. This
  would corrupt the lists and also lead to all kinds of misuse of meta chunks.

object caches:
* Implemented CACHE_ALIGN_ON_SIZE. It is no longer set for all small object
  caches, but the block allocator sets it on all power of two size caches.
* object_cache_reserve_internal(): Detect recursion and don't wait in such a
  case. The function could deadlock itself, since
  HashedObjectCache::CreateSlab() does allocate memory, thus potentially
  reentering.
* object_cache_low_memory():
  - I missed some returns when reworking that one in r35254, so the function
    might stop early and also leave the cache in maintenance mode, which would
    cause it to be ignored by object cache resizer and low memory handler from
    that point on.
  - Since ReturnSlab() potentially unlocks, the conditions weren't quite correct
    and too many slabs could be freed.
  - Simplified things a bit.
* object_cache_alloc(): Since object_cache_reserve_internal() does potentially
  unlock the cache, the situation might have changed and their might not be an
  empty slab available, but a partial one. The function would crash.
* Renamed the object cache tracing variable to SLAB_OBJECT_CACHE_TRACING.
* Renamed debugger command "cache_info" to "slab_cache" to avoid confusion with
  the VMCache commands.
* ObjectCache::usage was not maintained anymore since I introduced the
  MemoryManager. object_cache_get_usage() would thus always return 0 and the
  block cache would not be considered cached memory. This was only of
  informational relevance, though.

slab allocator misc.:
* Disable the object depots of block allocator caches for object sizes > 2 KB.
  Allocations of those sizes aren't so common that the object depots yield any
  benefit.
* The slab allocator is now fully self-sufficient. It allocates its bootstrap
  memory from the MemoryManager, and the hash tables for HashedObjectCaches use
  the block allocator instead of the heap, now.
* Added option to use the slab allocator for malloc() and friends
  (USE_SLAB_ALLOCATOR_FOR_MALLOC). Currently disabled. Works in principle and
  has virtually no lock contention. Handling for low memory situations is yet
  missing, though.
* Improved the output of some debugger commands.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35283 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-25 13:46:58 +00:00
Ingo Weinhold
71f65beeb3 Marked CACHE_UNLOCKED_PAGES as unsupported.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35281 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-25 12:22:36 +00:00
Ingo Weinhold
b20de45ebd * Added optional allocator template parameter.
* Added optional parameter "void** oldTable" to Resize(). If given the old
  allocation for the table is returned instead of freeing it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35278 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-25 12:18:20 +00:00
Clemens Zeidler
ef0f557c65 As suggested by Axel use addr_t and size_t.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35267 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-23 16:40:36 +00:00
Stephan Aßmus
c4e211feb6 * Refactored a method to draw a label when the location is already known.
(This one takes care of setting up the correct color.)
 * Added TODO about using either B_CONTROL_TEXT_COLOR, or elliminating that
   constant (which I am in favor of...).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35260 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-23 12:48:18 +00:00
Ingo Weinhold
8d1316fd23 Replaced CACHE_DONT_SLEEP by two new flags CACHE_DONT_WAIT_FOR_MEMORY and
CACHE_DONT_LOCK_KERNEL_SPACE. If the former is given, the slab memory manager
does not wait when reserving memory or pages. The latter prevents area
operations. The new flags add a bit of flexibility. E.g. when allocating page
mapping objects for userland areas CACHE_DONT_WAIT_FOR_MEMORY is sufficient,
i.e. the allocation will succeed as long as pages are available.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35246 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-22 21:19:23 +00:00
Ingo Weinhold
86c794e5c1 slab allocator:
* Implemented a more elaborated raw memory allocation backend (MemoryManager).
  We allocate 8 MB areas whose pages we allocate and map when needed. An area is
  divided into equally-sized chunks which form the basic units of allocation. We
  have areas with three possible chunk sizes (small, medium, large), which is
  basically what the ObjectCache implementations were using anyway.
* Added "uint32 flags" parameter to several of the slab allocator's object
  cache and object depot functions. E.g. object_depot_store() potentially wants
  to allocate memory for a magazine. But also in pure freeing functions it
  might eventually become useful to have those flags, since they could end up
  deleting an area, which might not be allowable in all situations. We should
  introduce specific flags to indicate that.
* Reworked the block allocator. Since the MemoryManager allocates block-aligned
  areas, maintains a hash table for lookup, and maps chunks to object caches,
  we can quickly find out which object cache a to be freed allocation belongs
  to and thus don't need the boundary tags anymore.
* Reworked the slab boot strap process. We allocate from the initial area only
  when really necessary, i.e. when the object cache for the respective
  allocation size has not been created yet. A single page is thus sufficient.

other:
* vm_allocate_early(): Added boolean "blockAlign" parameter. If true, the
  semantics is the same as for B_ANY_KERNEL_BLOCK_ADDRESS.
* Use an object cache for page mappings. This significantly reduces the
  contention on the heap bin locks.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35232 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-21 23:10:52 +00:00
Ingo Weinhold
5f679d1cd3 Resize(): Added boolean "force" parameter that allows to force setting the
new memory, even if it isn't needed at that time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35231 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-21 22:16:03 +00:00
Adrien Destugues
5570fd11c0 - Locale kit : made the language class live. It now uses ICU as a backend as expected
- Some changes in the locale roster to allow instanciating a language
- Locale preflet : use this new API instead of directly calling ICU
Side effect : all languages in Locale window are now displayed in the current locale. It makes more sense as otherwise the list would be unsortable. However it can get annoying if you mistakenly set a strange language as default.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35210 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-20 22:44:34 +00:00
Ingo Weinhold
453a2bdd18 Replaced the locking strategy (formerly a recursive lock for the depot and
one for each per CPU store):
* The depot is now protected by a R/W lock combined with a spinlock. It is
  required to either hold read lock + spinlock or just the write lock.
* When accessing the per CPU stores we only need to acquire the read lock
  and disable interrupts. When switching magazines with the depot we
  additionally get the spinlock.
* When allocating a new magazine we do completely unlock.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35200 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-20 13:00:57 +00:00
Ingo Weinhold
5662ae4585 Changed the team shutdown process a bit:
* The threads beside the main thread are killed earlier now (in the new
  team_shutdown_team()), before removing the team from the team hash and from
  its process group. This fixes #5296.
* Use a condition variable instead of a semaphore to wait for the non-main
  threads to die. We notify the condition right after a thread has left the
  team. The semaphore was released by the undertaker.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35196 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-20 09:34:53 +00:00
Ingo Weinhold
7dcd388aa6 Coding style fix.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35180 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 20:36:29 +00:00
Ingo Weinhold
825566f82f * Split the slab allocator code into separate source files and C++-ified
things a bit.
* Some style cleanup.
* The object depot does now have a cookie that will be passed to the return
  hook.
* Fixed object_cache_return_object_wrapper() using the new cookie.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35174 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 19:13:25 +00:00
Ingo Weinhold
0fc052b47d Moved the definition of the CACHE_ALIGN_ON_SIZE flag to the header and fixed
its value.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35163 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 10:17:16 +00:00
Ingo Weinhold
a8806e5e0d * Renamed headers/private/kernel/slab/Depot.h to ObjectDepot.h.
* Moved the object depot code to its own source file.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35161 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 10:12:48 +00:00
Ingo Weinhold
6379e53e2d vm_page no longer points directly to its containing cache, but rather to a
VMCacheRef object which points to the cache. This allows to optimize
VMCache::MoveAllPages(), since it no longer needs to iterate over all pages
to adjust their cache pointer. It can simple swap the cache refs of the two
caches instead.

Reduces the total -j8 Haiku image build time only marginally. The kernel time
drops almost 10%, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35155 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 08:34:14 +00:00
Ingo Weinhold
3632eeedb9 * VMCache: Added a UserData attribute which can be used by the lock holder.
* Added "bool consumerLocked" parameter to VMCache::Unlock() and
  ReleaseRefAndUnlock(). Since Unlock() may cause the cache to be merged with
  a consumer cache, the flag is needed to prevent a deadlock in case the
  caller still holds a lock to the consumer. Hasn't been a problem yet, since
  that situation never occurred.
* VMCacheChainLocker: Reversed unlocking order to bottom-up. The other
  direction could cause a deadlock in case caches would be merged, since the
  locking order would be reversed. The way VMCacheChainLocker was used this
  didn't happen, though.
* fault_get_page(): While copying a page from a lower cache to the top cache,
  we do now unlock all caches but the top one, so we don't unnecessarily
  kill concurrency.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35153 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 03:02:11 +00:00
Jérôme Duval
6aee58a4cb * Revert the reverse the addons iteration of r35121.
* The media_addon_server before unloading addons need to be sure the nodes are deleted.
For instance, applications could keep references on global nodes, thus preventing deletion.
To release all references, the media_addon server uses a new method BMediaRosterEx::ReleaseNodeAll().
* Quit the MediaRoster looper when quitting media_addon server before unloading addons.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35133 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-17 20:05:01 +00:00
Rene Gollent
782fbf00a7 Overlooked this with my previous Trash-related changes: updated NavMenu to be
behaviorally in sync - it now hides the root volume Trash dir like PoseView,
and adds the Trash entry as needed when navigating down the Desktop.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35125 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-17 17:35:06 +00:00
Oliver Ruiz Dorantes
9760dcae20 - Move bluetooth net_device module to a independent module HCI, remake API interfaces
- Move functionality for assembling ACL/events packets of the driver to this module
- Move h2generic driver to c++ (not style)
- Pass checkstyle.py to all commited files.
Fixes:
- Wrong condition for finishing l2cap packet segmentation.
- Place NetBuffersPrependers in a inner scope to avoid Sycing twice in destructor.
- Avoid keeping trace of l2cap responses of any other kind of thread.
- Do not free net_buffers of for Frame containers.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35117 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-17 15:46:36 +00:00
Jérôme Duval
66204ee8cf forgot to add prototypes for pthread_getschedparam and pthread_setschedparam(), sorry.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35106 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-16 19:33:34 +00:00
Ingo Weinhold
f082f7f019 * Added vm_page::accessed flag. Works analogously to vm_page::modified.
* Reorganized the code for [un]mapping pages:
  - Added new VMTranslationMap::Unmap{Area,Page[s]}() which essentially do what
    vm_unmap_page[s]() did before, just in the architecture specific code, which
    allows for specific optimizations. UnmapArea() is for the special case that
    the complete area is unmapped. Particularly in case the address space is
    deleted, some work can be saved. Several TODOs could be slain.
  - Since they are only used within vm.cpp vm_map_page() and vm_unmap_page[s]()
    are now static and have lost their prefix (and the "preserveModified"
    parameter).
* Added VMTranslationMap::Protect{Page,Area}(). They are just inline wrappers
  for Protect().
* X86VMTranslationMap::Protect(): Make sure not to accidentally clear the
  accessed/dirty flags.
* X86VMTranslationMap::Unmap()/Protect(): Make page table skipping actually
  work. It was only skipping to the next page.
* Adjusted the PPC code to at least compile.

No measurable effect for the -j8 Haiku image build time, though the kernel time
drops minimally.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35089 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-15 22:32:51 +00:00
Stephan Aßmus
9d3442dff1 Haiku defines B_BEOS_VERSION_5, so the code didn't work as intended. On Haiku,
we want to define closesocket() as close().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35079 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-14 21:50:50 +00:00
Stephan Aßmus
41777edb47 Make more defined classes visible outside the BPrivate namespace when including
this header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35078 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-14 21:49:53 +00:00
Stephan Aßmus
edb41bfb71 Added HashSet class based on the (OpenTracker) OpenHashTable code. This is
currently similar to HashMap, which is also based on that version. The kernel
has OpenHashTable by Hugo Santos, which is a bit nicer, but I didn't want to
change too much code, although HashMap and HashSet exist for this as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35077 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-14 21:49:16 +00:00
Ingo Weinhold
c6aa013564 Changed VMTranslationMap::Lock()/Unlock() return types to the usual.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35075 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-14 20:44:29 +00:00
Axel Dörfler
d9c5ba808b * Added missing HOST_NAME_MAX, and _POSIX_HOST_NAME_MAX.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35070 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-14 15:23:28 +00:00
Ingo Weinhold
bcc2c157a1 Refactored vm_translation_map:
* Pulled the physical page mapping functions out of vm_translation_map into
  a new interface VMPhysicalPageMapper.
* Renamed vm_translation_map to VMTranslationMap and made it a proper C++
  class. The functions in the operations vector have become methods.
* Added class GenericVMPhysicalPageMapper implementing VMPhysicalPageMapper
  as far as possible (without actually writing new code).
* Adjusted the x86 and the PPC specifics accordingly (untested for the
  latter). For the other architectures the build is, I'm afraid, seriously
  broken.

The next steps will modify and extend the VMTranslationMap interface, so that
it will be possible to fix the bugs in vm_unmap_page[s]() and employ
architecture specific optimizations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35066 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-14 03:26:12 +00:00
Ingo Weinhold
946325051b * Added boolean "alreadyWired" parameter to vm_map_physical_memory().
* ioapic_init(): map_physical_memory() was called for already mapped
  addresses. This worked fine, but only because the x86 page mapping code
  didn't mind.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35059 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-13 22:02:21 +00:00
Stephan Aßmus
9563f44bfd Patch by Humdinger:
Changed strings to sentence case in various places. This is the
case-misc.diff part of ticket #5169.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35043 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-13 10:49:58 +00:00
Stephan Aßmus
0b6ac0b7a8 * White space cleanup
* Added myself to copyrights, since I added some stuff to MediaExtractor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35031 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-12 20:24:10 +00:00
Ingo Weinhold
3b8c056da0 Should have been part of r35023: Introduction of the vm_page::modified flag.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35024 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-12 01:24:40 +00:00
Ingo Weinhold
3fb2a94dfb * Inline {acquire,release}_spinlock(), when spinlock debugging is disabled.
* Use atomic_{and,or}() instead of atomic_set(), as there are no built-ins
  for the latter.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35021 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-11 22:13:11 +00:00
Ingo Weinhold
4f7b2c67b0 * gcc 4 features built-ins for atomic operations. If the macro
B_USE_BUILTIN_ATOMIC_FUNCTIONS is defined most atomic_*() functions are
  redefined as macros using the built-ins directly.
* Enabled that feature for the x86 build. Might work on other platforms as
  well, but that needs to be tested.

No significant speedup for the -j8 Haiku image build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35018 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-11 21:38:07 +00:00
Ingo Weinhold
451ca8b4b4 PAGE_TYPE_GUARD was unused and for the other two types a simple one bit flag
suffices. Therefore replaced vm_page::type by vm_page::is_dummy.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35013 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-11 19:13:14 +00:00
Ingo Weinhold
d7455de2f6 allocate_page_run(): Use temporary lists to store the pages we're allocating.
This makes appending the pages to the active queue more efficient and we
don't need the vm_page::is_cleared bit anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35011 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-11 16:36:31 +00:00
Oliver Ruiz Dorantes
ee01456254 - Add macros to distingish between requests and responses
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34999 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-10 23:02:21 +00:00
Ingo Weinhold
509f1174ce * Added Size() method.
* Added Debug{First,Next}() methods to allow easy iteration through the
  address spaces in kernel debugger commands.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34978 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-09 20:21:43 +00:00
Ingo Weinhold
db28a227c4 Added GetIterator() version that takes a key and returns an iterator to the
respective element (if in the table).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34977 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-09 20:19:29 +00:00
Ingo Weinhold
924a3e5f9b Removed unused <arch>_switch_stack_and_call() and
arch_thread_switch_kstack_and_call().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34971 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-09 15:09:02 +00:00
Michael Lotz
14429e896e Reverted the part of r31520 that made devfs_unpublish_partition() take a raw
device path + child partition name. When a "raw" device is unpublished the node
removal notification triggers the partition and child partitions to be
unpublished/removed. Since in that case the "raw" node is already unpublished
trying to resolve it in devfs_unpublish_partition() again to unpublish the child
partitions would fail, leaving the child partition nodes behind. When a new raw
device would then become available publishing its partitions would fail because
of these left behind nodes, causing bug #4587. Seeing that this code is more
compact and straight forward anyway I don't quite see why it was changed in the
first place.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34967 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-09 03:55:38 +00:00
Ingo Weinhold
77690f288e Added VMCache::SwitchFromReadLock(), atomically unlocking a read lock and
starting to lock the cache.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34936 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-07 15:32:28 +00:00
Ingo Weinhold
c4f9831292 Added new mutex_switch_from_read_lock() for unlocking a read lock and
starting to lock a mutex in an atomic operation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34935 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-07 15:31:29 +00:00
Ingo Weinhold
8ab820f076 VMAddressSpace::Put() is too hot to always write lock the address spaces
table. It is now inline and uses double-checked locking. This reduces the
contention on the lock to insignificant. Total -j8 Haiku image build speedup
is marginal, but the total kernel time drops 12%.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34934 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-07 14:09:56 +00:00
Ingo Weinhold
3cd2094396 * Added new debug feature (DEBUG_PAGE_ACCESS) to detect invalid concurrent
access to a vm_page. It is basically an atomically accessed thread ID field
  in the vm_page structure, which is explicitly set by macros marking the
  critical sections. As a first positive effect I had to review quite a bit of
  code and found several issues.
* Added several TODOs and comments. Some harmless ones, but also a few
  troublesome ones in vm.cpp regarding page unmapping.
* file_cache: PrecacheIO::Prepare()/read_into_cache: Removed superfluous
  vm_page_allocate_page() return value checks. It cannot fail anymore.
* Removed the heavily contended "pages" lock. We use different policies now:
  - sModifiedTemporaryPages is accessed atomically.
  - sPageDeficitLock and sFreePageCondition are protected by a new mutex.
  - The page queues have individual locks (mutexes).
  - Renamed set_page_state_nolock() to set_page_state(). Unless the caller says
    otherwise, it does now lock the affected pages queues itself. Also changed
    the return value to void -- we panic() anyway.
* set_page_state(): Add free/clear pages to the beginning of their respective
  queues as this is more cache-friendly.
* Pages with the states PAGE_STATE_WIRED or PAGE_STATE_UNUSED are no longer
  in any queue. They were in the "active" queue, but there's no good reason
  to have them there. In case we decide to let the page daemon work the queues
  (like FreeBSD) they would just be in the way.
* Pulled the common part of vm_page_allocate_page_run[_no_base]() into a helper
  function. Also fixed a bug I introduced previously: The functions must not
  vm_page_unreserve_pages() on success, since they remove the pages from the
  free/clear queue without decrementing sUnreservedFreePages.
* vm_page_set_state(): Changed return type to void. The function cannot really
  fail and no-one was checking it anyway.
* vm_page_free(), vm_page_set_state(): Added assertion: The page must not be
  free/clear before. This is implied by the policy that no-one is allowed to
  access free/clear pages without holding the respective queue's lock, which is
  not the case at this point. This found the bug fixed in r34912.
* vm_page_requeue(): Added general assertions. panic() when requeuing of
  free/clear pages is requested. Same reason as above.
* vm_clone_area(), B_FULL_LOCK case: Don't map busy pages. The implementation is
  still not correct, though.

My usual -j8 Haiku build test runs another 10% faster, now. The total kernel
time drops about 18%. As hoped the new locks have only a fraction of the old
"pages" lock contention. Other locks lead the "most wanted list" now.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34933 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-07 02:37:05 +00:00
Stephan Aßmus
3a57be2aea * Indentation and naming cleanup in the header
* Small coding style cleanups in the .cpp
 * When reading raw chunks, keep fCurrentFrame updated anyway
 * When decoding frames and chunks, don't change the meaning of fCurrentTime,
   it's supposed to be the start time of the next chunk/frame, same as
   CurrentFrame(), not the time of the frame/chunk we just decoded/read.
   BMediaTrack::CurrentFrame() is actually documented like this in the BeBook,
   but CurrentTime() is not. However, when seeking to a specific time, it is
   understood that this is the time of the next frame/chunk. If we decode/read
   it and set fCurrentTime to the start_time as specified in the media_header,
   it would actually not change for the first frame/chunk after seeking.
   To be able to know the duration of chunks, fWriterFormat had to be changed
   to just fFormat and is now used for decoding as well.
* Simplified handling of media_header in some methods, saves one assignment.

These changes are not so well tested, yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34923 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-07 00:55:55 +00:00
Axel Dörfler
f0a1eb2dba * The static object construction and destruction is no longer random, but takes
the internal dependencies into account. This should fix bugs #5166, #5120,
  and #5150.
* Also, the time source object manager, as well as the dormant node manager
  are now recreated on media roster restart (when the media server is
  restarted).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34906 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-05 16:53:55 +00:00
Oliver Ruiz Dorantes
deac8b50fa - sizeof(TYPE) would cause problems to instantiations of the class with void type
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34883 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-03 22:35:18 +00:00
Oliver Ruiz Dorantes
23992a691c - Port & Thread string's name allocation was messed and used in InitCheck.
- Style, spacing binary operator



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34881 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-03 21:30:26 +00:00
Oliver Ruiz Dorantes
d923116745 Fix mask and endline style
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34880 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-03 21:19:47 +00:00
Ingo Weinhold
5800e8a486 * Moved the page management functionality into its own file.
* Renamed page_queue to VMPageQueue and made it a proper C++ class. Use
  DoublyLinkedList instead of own list code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34874 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-03 17:10:32 +00:00
Ingo Weinhold
be7782af0f * Removed DoublyLinkedListLinkImpl constructor. DoublyLinkedListLink doesn't
have one anymore anyway.
* Removed unnecessary setting the list links to NULL after removing a node.
* Replaced "element == NULL" check in Insert() by an assert. This just hid
  potential errors.
* Added Insert{Before,After}() methods and declared the Insert() version
  with the InsertBefore() semantics obsolete.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34873 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-03 17:07:56 +00:00
Stephan Aßmus
f5088d8f82 Patch by Andreas Faerber:
* Define __BYTE_ORDER for Solaris host.

Thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34849 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-02 09:24:57 +00:00
Axel Dörfler
4e8123ba98 * Accidently moved the fdopendir() prototype around.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34839 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-01 18:52:09 +00:00
Axel Dörfler
31e49a2f1d * Implemented missing alphasort(), and scandir() POSIX functions. Completely
untested yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34838 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-01 18:49:55 +00:00
Ingo Weinhold
355dc6bef4 Inlined several VMCache methods.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34837 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-01 17:09:23 +00:00
Ingo Weinhold
1021fd2826 * agp_gart(): Use vm_page_[un]reserve_pages().
* Removed unused vm_page_allocate_pages().
* Removed now unused (always true) "reserved" parameter from
  vm_page_allocate_page().
* Removed unused (always false) "stealActive" parameter from steal_page().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34836 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-01 16:37:14 +00:00
Axel Dörfler
e30dd2c076 * If the VESA driver remaps the frame buffer on init, it will now also make
sure that the kernel's frame buffer console points to the right data.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34835 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-01 14:54:41 +00:00
Ingo Weinhold
2ea2527fe4 R/W lock implementation:
* Changed the rw_lock_{read,write}_unlock() return values to void. They
  returned a value != B_OK only in case of user error and no-one checked them
  anyway.
* Optimized rw_lock_read_[un]lock(). They are inline now and as long as
  there's no contending write locker, they will only perform an atomic_add().
* Changed the semantics of nested locking after acquiring a write lock: Read
  and write locks are counted separately, so read locks no longer implicitly
  become write locks. This does e.g. make degrading a write lock to a read
  lock by way of read_lock + write_unlock (as used in the VM) actually work.

These changes speed up the -j8 Haiku image build on my machine by a few
percent, but more interestingly they reduce the total kernel time by 25 %.
Apparently we get more contention on other locks, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34830 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-31 17:03:41 +00:00
Ingo Weinhold
eb8dc1ebfb * Removed DEBUG_PAGE_CACHE_TRANSITIONS debugging.
* Added VMCache::MovePage() and MoveAllPages() to move pages between caches.
* VMAnonymousCache:
  - _MergeSwapPages(): Avoid doing anything, if neither cache has swapped out
    pages.
  - _MergeSwapPages() does now also remove source cache pages that are
    shadowed by consumer swap pages. This allows us to call _MergeSwapPages()
    before _MergePagesSmallerSource(), save the swap page shadowing check
    there and get rid of the vm_page::merge_swap flag. This is an
    optimization based on the assumption that usually none or only few pages
    are swapped out, so we save a lot of checks.
  - Implemented _MergePagesSmallerConsumer() as an alternative to
    _MergePagesSmallerSource(). The former is used when the source cache has
    more pages than the consumer cache. It iterates over the consumer cache's
    pages, moves them to the source and finally moves all pages back to the
    consumer. The final move is relatively cheap (though unfortunately we
    still have to update all pages' vm_page::cache field), so that overall we
    save iterations of the main loop with the more expensive checks.

The optimizations particularly improve the common fork()+exec*() situations.
fork() uses CoW, which is implemented by putting two new empty caches between
the to be copied area and its cache. exec*() destroys one copy of the area,
its cache and thus causes merging of the other new cache with the old cache.
Since this usually happens in a very short time, the old cache does still
contain many pages and the new cache only few. Previously the many pages were
all checked and moved individually. Now we do that for the few pages instead.

A very extreme example of this situation is the Haiku image build. jam has a
huge heap (> 200 MB) and it fork()s+exec*()s for every action to be executed.
Since during the cache merging the cache is locked, any write access to a
heap page causes jam to block until the cache merging is done. Formerly that
took so long that it killed a lot of parallelism in multi-job builds. That
could be observed particularly well when lots of small actions where executed
(like the Link, XRes, Mimeset, SetType, SetVersion combos when building
executables/libraries/add-ons). Those look dramatically better now.
The overall speed improvement for a -j8 image build on my machine is only
about 15%, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34784 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-27 16:14:13 +00:00
Ingo Weinhold
6afe50d424 * Added assignment operators.
* Some automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34783 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-27 15:19:17 +00:00
Ingo Weinhold
2e74d74f4f * Added method VMCache::TransferAreas() moving areas from one cache to
another. The code originates from vm_copy_on_write_area(). We now generate
  the VM cache tracing entries, though.
* count_writable_areas() -> VMCache::CountWritableAreas()
* Added debugger command "cache_stack" which is enabled when VM cache tracing
  is enabled. It prints the source caches of a given cache or area at the
  time of a specified tracing entry.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34751 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-22 22:00:35 +00:00
Colin Günther
cfcee452a4 Whitespace cleanup, no functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34748 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-22 16:53:28 +00:00
Ingo Weinhold
a38f850360 * arch_debug_get_stack_trace():
- Replaced the "userOnly" parameter by a "flags" parameter, that allows to
    specify kernel and userland stack traces individually.
  - x86, m68k: Don't always skip the first frame as that prevents the caller
    from being able to record its own address.
* capture_tracing_stack_trace(): Replaced the "userOnly" parameter by
  "kernelOnly", since one is probably always interested in the kernel stack
  trace, but might not want the userland stack trace.
* Added stack trace support for VM cache kernel tracing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34742 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-22 15:15:07 +00:00
Ingo Weinhold
1fde952c1d DefaultNotificationService:
* Added Lock()/Unlock() for explicit locking by a service user.
* Added NotifyLocked() and made Notify() inline.
* Added HasListeners() so one can check whether there is a listener at all
  before preparing the event message.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34736 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-21 20:56:50 +00:00
Ingo Weinhold
97eaabdfb0 Also allow gcc 3 as the host compiler.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34717 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-20 13:07:43 +00:00
Ingo Weinhold
189010cbc2 Added support for I/O scheduling events to the system profiler interface.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34703 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-19 14:33:29 +00:00
Axel Dörfler
861f2ade03 * Rewrote header.
* Cleaned up private method names as much as possible (it's probably not a good
  idea to rename BStatable::set_stat() for compatibility reasons).
* Cleaned up sources.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34690 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-18 15:05:37 +00:00
Ingo Weinhold
0338371f26 * All scheduler implementations:
- enqueue_in_run_queue() no longer returns whether rescheduling is supposed
    to happen. Instead is sets cpu_ent::invoke_scheduler on the current CPU.
  - reschedule() does now handle cpu_ent::invoke_scheduler_if_idle(). No need
    to let all callers do that.
* thread_unblock[_locked]() no longer return whether rescheduling is supposed
  to happen.
* Got rid of the B_INVOKE_SCHEDULER handling. The interrupt hooks really
  can't know, when it makes sense to reschedule or not.
* Introduced scheduler_reschedule_if_necessary[_locked]() functions for
  checking+invoking the scheduler.
* Some semaphore functions (e.g. delete_sem()) invoke the scheduler now, if
  they wake up anything with greater priority.
  I've also tried to add scheduler invocations in the condition variable and
  mutex/rw_lock code, but that actually has a negative impact on performance,
  probably because it causes too much ping-ponging between threads when
  multiple locking primitives are involved.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34657 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-13 21:18:27 +00:00
Jérôme Duval
fe69204315 added more missing prototypes in math.h
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34654 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-13 16:35:25 +00:00
Jérôme Duval
0270440a97 added missing prototypes for fmin, fma, fmax functions.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34653 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-13 16:22:56 +00:00
Ingo Weinhold
4c06f2b600 Added boolean deleteIfOwning parameter to MakeEmpty().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34643 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-12 18:17:15 +00:00
Ingo Weinhold
b4be7c9021 * Added cpu_ent::running_thread which is maintained by the schedulers.
* simple_smp scheduler: Rewrote the interesting part of
  enqueue_in_run_queue(). It always selects a target CPU for the inserted
  thread, now. If no CPU is idle, the CPU running the thread with the lowest
  priority is chosen. If the thread running on the target CPU has a lower
  priority than the inserted one, it will be asked to reschedule. If that's
  the current CPU, we'll return the correct value (wasn't done before at
  all).
  These changes help reducing latencies. On my machine in an idle system
  playing music DebugAnalyzer shows maximum latencies of about 1 us. I still
  find that a bit much, but it's several orders of magnitude better than
  before. The -j8 Haiku image build time dropped about 10%.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34635 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-11 19:06:57 +00:00
Colin Günther
281f1ab86c Choosing an even number for SIOCEND as suggested by François. Thank you.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34625 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-10 20:51:26 +00:00
Colin Günther
b56f3c65ff Add two more socket ioctl's as they are needed by the aironet (if_an.c) and
wavelan (if_wi.c) drivers I'm currently porting.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34617 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-10 15:46:37 +00:00
Ingo Weinhold
3533b6597d * Reintroduced the SMP_MSG_RESCHEDULE_IF_IDLE ICI message. This time
implemented by means of an additional member in cpu_ent.
* Removed thread::keep_scheduled and the related functions. The feature
  wasn't used yet and wouldn't have worked as implemented anyway.
* Resurrected an older, SMP aware version of our simple scheduler and made it
  the default instead of the affine scheduler. The latter is in no state to
  be used yet. It causes enormous latencies (I've seen up to 0.1s) even when
  six or seven CPUs were idle at the same time, totally killing parallelism.
  That's also the reason why a -j8 build was slower than a -j2. This is no
  longer the case. On my machine the -j2 build takes about 10% less time now
  and the -j8 build saves another 20%. The latter is not particularly
  impressive (compared with Linux), but that seems to be due to lock
  contention.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34615 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-10 11:54:38 +00:00