Age | Commit message (Collapse) | Author |
|
|
|
Leverage constexpr and __builtin_ffs for Bitmap::find_first. Also add
a variant Bitmap::find_one_anywhere that can start scanning at a
provided hint.
Also, merge Bitmap::fill_range into the already existing Bitmap::set_range
|
|
|
|
Before, we had about these occurrence counts:
COPY: 13 without, 33 with
MOVE: 12 without, 28 with
Clearly, 'with' was the preferred way. However, this introduced double-semicolons
all over the place, and caused some warnings to trigger.
This patch *forces* the usage of a semi-colon when calling the macro,
by removing the semi-colon within the macro. (And thus also gets rid
of the double-semicolon.)
|
|
When we switched the Bitmap code to operating 32 bits at a time,
we neglected to look in the trailing remainder bits after the last
full 32-bit word.
This patch fixes that and adds a couple of tests for Bitmap that I
hacked up while tracking down this bug.
I found this bug when noticing that the kernel would OOM while there
were still some pages left in the physical page allocator.
|
|
Add find_best_fit() which implements best fit allocation algorithm.
Kmalloc now uses a best fit allocation policy for large allocations.
|
|
AK::Bitmap is extended with find_next_range_of_unset_bits().
The function is implemented using count_trailing_zeroes_32(), which is
optimized on many platforms, that gives a huge performance boost.
Functions find_longest_range_of_unset_bits() and find_first_fit() are
implemented with find_next_range_of_unset_bits(). According to
benchmarks, they are 60-100% faster.
|
|
Add find_first_fit() which implements first fit algorithm.
|
|
Add set_range() which sets a range of bits to requested value.
Fix code style.
|
|
|
|
We can use __builtin_memset() without including <string.h>.
This is pretty neat, as it will allow us to reduce the header deps
of AK templates a bit, if applied consistently.
Note that this is an enabling change for an upcoming #include removal.
|
|
This was causing some obvious-in-hindsight but hard to spot bugs where
we'd implicitly convert the bool to an integer type and carry on with
the number 1 instead of the actual value().
|
|
|
|
|
|
Also rework its API's to return Optional<size_t> instead of int with -1
as the error value.
|
|
This implementation uses the new helper method of Bitmap called
find_longest_range_of_unset_bits. This method looks for the biggest
range of contiguous bits unset in the bitmap and returns the start of
the range back to the caller.
|
|
As suggested by Joshua, this commit adds the 2-clause BSD license as a
comment block to the top of every source file.
For the first pass, I've just added myself for simplicity. I encourage
everyone to add themselves as copyright holders of any file they've
added or modified in some significant way. If I've added myself in
error somewhere, feel free to replace it with the appropriate copyright
holder instead.
Going forward, all new source files should include a license header.
|
|
I don't love this, but I also don't love the Bitmap class in general.
|
|
We were falling back to an incorrect compiler-generated copy ctor for
this class, and let's not do that.
Found by PVS-Studio.
|
|
These types can be picked up by including <AK/Types.h>:
* u8, u16, u32, u64 (unsigned)
* i8, i16, i32, i64 (signed)
|
|
|
|
Also run it across the whole tree to get everything using the One True Style.
We don't yet run this in an automated fashion as it's a little slow, but
there is a snippet to do so in makeall.sh.
|
|
|
|
I'm still feeling this out, but I am starting to like the general idea.
|
|
|
|
|
|
sys$fork() now clones all writable regions with per-page COW bits.
The pages are then mapped read-only and we handle a PF by COWing the pages.
This is quite delightful. Obviously there's lots of work to do still,
and it needs better data structures, but the general concept works.
|
|
|