Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VFS dcache work (& misc) #124

Merged
merged 40 commits into from
Jul 29, 2024
Merged

VFS dcache work (& misc) #124

merged 40 commits into from
Jul 29, 2024

Conversation

heatd
Copy link
Owner

@heatd heatd commented Jul 20, 2024

No description provided.

heatd added 29 commits July 23, 2024 02:16
What seems to be an innocent check doesn't actually work, since pages
can be unmapped by a variety of reasons (e.g truncation), and
mapcount = 0 && ref > 1 doesn't exactly mean it's a leaked page.

Signed-off-by: Pedro Falcato <[email protected]>
The comparison was wrong and the signal setting was wrong too.

Signed-off-by: Pedro Falcato <[email protected]>
Lets start progressively switching architectures to the shared code.
First off, x86.

Signed-off-by: Pedro Falcato <[email protected]>
fsyncdata provides fsync/writeback-like semantics like regular
writeback-needing filesystems, and allows us to pass tests/emulate
fsync/msync/fsyncdata as required.

Signed-off-by: Pedro Falcato <[email protected]>
Switch riscv64 to the new page table code, and add a few new wrappers
and headers (pmd_mkpmd, et al). This commit also fixed fork() breakage
that was introduced at some unknown point in time.

Signed-off-by: Pedro Falcato <[email protected]>
Add kmem_cache_alloc_bulk and free_bulk, which allow us to allocate
objects in batches, as efficiently as the allocator allows (avoiding
relocking or a preempt-off/preempt-on dance).

Signed-off-by: Pedro Falcato <[email protected]>
Signed-off-by: Pedro Falcato <[email protected]>
Add GFP_NOWAIT and a linux-compat helper.

Signed-off-by: Pedro Falcato <[email protected]>
Signed-off-by: Pedro Falcato <[email protected]>
Add Maple Tree, an RCU-ready btree implementation. Taken from Linux,
commit d67978318827d06f1c0fa4c31343a279e9df6fde.

Relevant xarray bits are also copied over.

Signed-off-by: Pedro Falcato <[email protected]>
The maple tree is faster, allows for RCU *and* gives us efficient range
allocation for free. Yay!

Signed-off-by: Pedro Falcato <[email protected]>
We botched redzone aligning for a good while, which resulted in
alignment problems when freeing (particularly if the caller
expected a certain alignment for pointer bit usage, like maple tree).

Signed-off-by: Pedro Falcato <[email protected]>
We were leaking packetbufs as we didn't unref them after going down the
stack.

Signed-off-by: Pedro Falcato <[email protected]>
So, it turns out we were assuming we assuredly had mapcount = 0 after
unmapping, since we held the lock. This somewhat makes sense, but misses
the edge case of a fork happening (incrementing mapcount) and not being
seen by the unmap code. So, instead of CHECK()ing for mapcount = 0, just
return failure to remove the page. This should activate the page and
guarantee forward progress.

Signed-off-by: Pedro Falcato <[email protected]>
Instead of maintaing a separate data layer (amaps), store the pages in
the page tables. After mapping a new anon, put the page. This results in
the page's mapcount working like an automatic anon page refcount. While
on it, we also implement an optimization where CoW'ing anon pages with
mapcount = 1 do not get copied, but rather reused and remapped writable.

Signed-off-by: Pedro Falcato <[email protected]>
Refactor sys_mmap, simplifying and organizing the code. This should also
result in a nice speedup.

Signed-off-by: Pedro Falcato <[email protected]>
Delete and staticify a *lot* of stuff.

Signed-off-by: Pedro Falcato <[email protected]>
Collapse vm_maptype into vm_flags.

Signed-off-by: Pedro Falcato <[email protected]>
Add vma merging capabilities for mmap.

Signed-off-by: Pedro Falcato <[email protected]>
If we don't reset WP, we might write into .text or rodata or even screw
up when it comes to copy_to_user. How we didn't see related mysterious
problems before is beyond me...

Signed-off-by: Pedro Falcato <[email protected]>
Improve rename by adding a .rename operation. Also fix various refcount
issues, etc.

Signed-off-by: Pedro Falcato <[email protected]>
Add some simple tests for rename + nlink.

Signed-off-by: Pedro Falcato <[email protected]>
Signed-off-by: Pedro Falcato <[email protected]>
heatd added 3 commits July 29, 2024 19:21
Support dynamically setting the log level (through format) by playing
some little tricks with the buffer.

Signed-off-by: Pedro Falcato <[email protected]>
cputime account is severely wrong in certain cases (e.g make build).
Let's temporarily use the scheduler's ticks. This should also be faster
(but I didn't bother putting much time into this).

Signed-off-by: Pedro Falcato <[email protected]>
We were erroneously double freeing.

Signed-off-by: Pedro Falcato <[email protected]>
heatd added 8 commits July 29, 2024 20:00
Add a WARN_ON implementation, with an x86 optimized variant.

Signed-off-by: Pedro Falcato <[email protected]>
Signed-off-by: Pedro Falcato <[email protected]>
We weren't converting it properly, which resulted in bogus d_type
readdir entries.

Signed-off-by: Pedro Falcato <[email protected]>
Don't use mas_expected_entries (for some reason, resulted in
corruption). Also properly destroy the mas state.

Signed-off-by: Pedro Falcato <[email protected]>
Signed-off-by: Pedro Falcato <[email protected]>
Add test_maple_tree (with Onyx patching on top), in sync with the maple
tree's version. This is not a KUNIT test but is only built and ran if
CONFIG_KUNIT.

Signed-off-by: Pedro Falcato <[email protected]>
@heatd heatd marked this pull request as ready for review July 29, 2024 19:07
@heatd heatd merged commit 416db3b into master Jul 29, 2024
23 checks passed
@heatd heatd deleted the pedro/vfs branch July 29, 2024 19:09
@heatd heatd mentioned this pull request Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant