* Don't write-lock the node when opening or closing a file unless the
node is actually being modified.
* Incidentally, move code from dosfs_close to dosfs_free_cookie. This
is not necessary to avoid this deadlock, but it is more consistent
with the approach of the BFS driver.
* When dragging and dropping a large file (e.g. 100 MB) in Tracker, it
is possible for BPoseView::AttributeChanged() to open the file in the
middle of the operation, which will deadlock with MoveItem() if
opening involves a write lock.
Change-Id: Ifc430e1e583cacff2eeb7283100417e16e3f1f5b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7881
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This way we avoid lock contention if multiple threads are trying
to delete areas at once.
Same benchmark and "before" as previous commit:
real 0m14.522s
user 0m14.194s
sys 0m4.337s
after:
real 0m13.810s
user 0m14.145s
sys 0m4.155s
Every time a page is mapped into an area on fault, we have to
allocate a mapping object for it. While the object_cache
does have per-CPU depots, these depots only store a limited
number of items, and once they run out the object_cache's lock
must be acquired.
So, to reduce lock contention on SMP systems, create a number
of object caches corresponding to the nearest power of 2
that is equal or smaller than the count of CPUs. (We already
allocate dozens of object caches for the block allocator
no matter how many CPUs there are, so a few more depending
on CPU count shouldn't impact memory use too much. Besides,
the object_caches are wired into the low_resource system.)
This significantly reduces lock contention on SMP systems.
Same benchmark setup as yesterday (compile mime_db and relink
HaikuDepot, VMware, -j4), before:
real 0m16.981s
user 0m14.357s
sys 0m6.060s
after:
real 0m14.522s
user 0m14.194s
sys 0m4.337s
And the page_mappings object_cache locks went from having 200,000+ waits
and ~14 seconds waiting time (across all threads) down to ~900 (yes,
that's not a typo) and ~0.05s wait time (though these numbers were captured
in conjunction with the following commit.)
The same as we do for prefetch. Otherwise very large areas
will spend an inordinate amount of time in premapping,
rather than just letting the fault handler do its job.
usage_count is set by the page_daemon, and as such isn't often
updated. In order to check whether new or "hot" pages are in-use,
we need to check their "accessed" flag directly.
This is a significant speed improvement, especially in heavily-contended
mapped files (e.g. shared libraries in a compile job.)
Same benchmark (compile the mime_db and relink HaikuDepot):
before (same as previous commit's "after"):
real 0m18.789s
user 0m14.880s
sys 0m8.779s
after:
real 0m16.615s
user 0m13.919s
sys 0m5.972s
If there are already more pages in the cache then we would be
prefetching, don't even call cache_prefetch_vnode(). This
cuts down on lock contention and avoids having to look up
whether the pages already exist (an operation that can take
hundreds of microseconds if we have thousands of pages.)
Time to rebuild the mime_db and relink HaikuDepot, best of
multiple runs (on VMware with -j4):
before:
real 0m19.005s
user 0m14.820s
sys 0m9.118s
after:
real 0m18.789s
user 0m14.880s
sys 0m8.779s
It seems there is presently a race between debugger state teardown
and canceling the profiling timer, which can lead to timers being
double-added in some circumstances (which hangs the system.)
Obviously that should be fixed, but for now adjust things
so that we catch this in an ASSERT.
Taken from FreeBSD but musl has the same. Does improve loading time.
Change-Id: I41c1f37e8948169a50d8989cc465998282fadaf8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7898
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This is an alternative to DT_HASH (SystemV/SVR4 hash tables.) Notably,
it uses a Bloom filter to allow an entire image to be skipped
at once rather than searching the actual symbol hash.
We don't currently build anything with DT_GNU_HASH support.
You can test this by adding -Wl,--hash-style=both to HAIKU_LINKFLAGS.
(It seems to increase image sizes by not too much: libroot goes
from 1347139 to 1367691 bytes (20.55 KB) in my build.)
Change-Id: I4a91276490fcd136db175833ee48b36e06ceed47
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7855
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
* Move the symbol testing out into its own method.
* Check the symbol name after the type (as that's a cheaper check.)
* Move some functions around to closer to where they are actually used.
Change-Id: I99c25eac6b03b0cb7e5a3edee80b222bc0325d4d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7854
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Nothing uses it, and it just allowed for mistakes like the one
corrected in the last commit to go unnoticed.
Change-Id: I5a64b45eb6f1f9abc9f98be14c9ff6d04c2814fa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7853
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This reverts commit 61987fe7a2.
The original commit had a typo in it preventing this logic from
working (the "true" should be after the first ")".) It ultimately
doesn't seem to be needed, and just complicates the ELF lookup logic.
Change-Id: I23df8c86ad61cac4db45af2ae4ab69635a9e4a33
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7852
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
* Put close/free at the beginning since all FDs must implement that.
(Most of the function declarations inline were already in this order.)
* Add readv/writev hooks. Not used yet, but this will allow for
more than just files to implement them. All declarations updated
to have NULL for the hooks for the moment.
It allows introducing new file descriptor types without editing enumeration every time. Anonymous FDs will be needed for Mesa
OpenGL/Vulkan drivers to reference GPU memory buffers and other driver objects that can be referenced as FDs from userland.
This change breaks private VFS API compatibility.
No behavior changes intended.
Change-Id: Iac109aad420b0b6aae704b38619436e01dcf4969
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7838
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This only happens on team exit and exec. In the exec case, we can
just document that this implies all images are removed from the team.
It appears all consumers of the debugger API handle this correctly as-is.
Let the loop handle the iframe instead of processing it up front,
so that it doesn't call get_next_frame_no_debugger the first time around.
Fixes the profiler skipping the first function when profiling user
space only.
Non-functional change to factor the package filters
from the main model for the application.
Change-Id: I58f741c4491baba8afd5dd6e32bb0f7cdf64938f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7896
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This used to be the default in haikuporter, but it isn't anymore. This
resulted in source packages (which are needed for bootstrap) not being
generated.
The drawing code in the package list view is now
unified with other places where the rating stars are
being displayed.
Change-Id: I6a8fef51a6ddc57d10cd62a98a26a65de9cd91c6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7879
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Otherwise, it seems compiler will optimize the assign operation into
a call of the first constructor, meaning the thread's syscall flag
won't be set properly.
Fixes #18951.
Instead of doing the checks in profiling_do_sample, we now do them
in profiling_event. This allows some comments to be consolidated
and make the logic clearer (but it should be functionally the same.)
Also add a check that profiling is still happening at the end
of profiling_flush.
Instead of taking the sample inside the timer callback
or the flush callback depending, always take it in the timer
callback, for consistency's sake. This should always work
because we try to flush the buffer when it's only 70% full;
in testing I can't recall seeing any dropped ticks.
Also add a flush call in the post_syscall hook, in case
we hit the flush threshhold while profiling in the kernel
and couldn't trigger the flush then.
Seems to significantly reduce "missed" ticks overall,
but there are still wildly inconsistent results and
lots of missing time.
Change-Id: I43a5e9c050a50309329da39f8a2386c3e2b3c0dd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7851
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Before this, changing the locale settings via Locale preflet required
a reboot in order for the changes to get picked up by programs running
on Terminal.
Fixes: #18734
Change-Id: I149931c511020f9eb881e71f79d1fd6c647477e2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7792
Reviewed-by: nephele nephele <nep-git@packageloss.eu>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Fix aspects of HaikuDepot's UI that do not scale when
the font size changes to accommodate a high resolution
monitor.
Change-Id: I105ebfe5a8f501cd7ffc22822438147ba07382a3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7844
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
switch credits in AboutSystem from udis86 to zydis
Change-Id: I03a7965a272c50714df9726e53c7d4067d8f1925
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7850
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
* for GCC2 build with a modern GCC as suggested by waddlesplash
* make the headers compatible with GCC2
Change-Id: Ice74eeddbe10bc8f9cf9ae90baa833a46bb3c676
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7848
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
* udis86 isn't updated since 2014. New SIMD opcodes are missing.
Thus replaces udis86 with Zydis, which is actively developed and used in
Webkit, SpiderMonkey. It is under MIT license.
* encoder code is removed
Change-Id: Ieae7e829e186ce7d4a6df640c62561ad220858fe
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7847
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
We can't call user_debug_image_deleted with the lock held, so clear
the list and remove all images before unlocking and looping again.
This also means we free() without the lock held, which should
reduce contention.