Eviction - #9
Open
SapphireHue wants to merge 52 commits into
Open
Conversation
- AI-generated - Hopefully doesn't break anything :D
- Mostly AI generated - Reviewed & edited by me though
- Someone should double check this
- Initialization takes ~1-2 seconds per run instead of 40 :D Co-authored-by: Brooks Bryant <brooks.bryant@icloud.com>
b-Rocks2718
reviewed
Apr 25, 2026
- Do dirty bit tracking in the Page struct instead
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
- need to think about allll the race conditions. Yippee!
- This passes even without doing lock ordering, which makes sense, I guess Co-authored-by: Copilot <copilot@github.com>
- Pulling from the PTE to the TLB must be "atomic" (can't have eviction happen) - Revalidate PTE value before modifying
- when tearing down another thread, we should removeRef based on the pid of the thread being destructed, not based on the running thread
Locks must be acquired in order: 1. Page lock 2. INode lock 3. Page cache lock Remaining: - Accessing invalid frame indices sometimes? (Probably concurrency issues) - God the output of the file is not what we want (but that's a problem of releasing the cache lock before acquiring the page lock during IO)
- The goal is to get lots of eviction As threads are writing, and for writes to be reasonably balanced between threads. That's not Really happening? But fuck it we ball
- I need to be lobotomized 🙃
- spamming debug prints I guess
- In case: thread A finds a cache entry and blocks on the page, the cache entry is freed (eviction) by another thread, and then faulted back in by another thread (so it's an equivalent entry but at a different address), and then thread A wakes back up - "maybe" is because I'm not 100% certain this is a bug
- for a page cache page, "PINNED" = it's still being read in, which means both that it's not evictable AND that the data isn't stable yet - We kiiind of want the page a cache entry points to to be a promise, but we want to be able to free the cache entry without having to deal with waking up or waiting on the waiters, so for now we just use the flag
- Since IPI now sends to all cores, instead of excluding the one that sent it
…kill user / uaccess helper logic
SapphireHue
marked this pull request as ready for review
May 7, 2026 22:01
…` field in inode
- Allows us to maintain a correct rounded tail size
- Previously, truncate tests were failing because changing the inode size had no effect if relevant pages were still in the cache - Now, we remove pages from the cache when truncating - Someone should definitely make sure nothing sketchy is happening...
- Enlarge text section and shrink data section - Allows ext_delete to build correctly - Future section overflows will error during build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Provides the mechanism to safely evict a page.
Adds the physical memory map, a flat array of metadata for physical frames (0x800000 - 0x7FB7FFF). Each page's metadata contains a lock, a reverse mapping, and flags.
Each time a page managed by the page cache is mapped or unmapped, it's reverse mapping is updated.
Splits the TLB miss handler into a TLB miss handler (walks the page table and updates the TLB value if the page table value is satisfactory) and a page fault handler (traditional page fault handling because the PTE value is insufficient).
Performs dirty bit tracking on first write (instead of conservatively when mapped with write permissions)
Adds a function to perform synchronous TLB shootdown across all cores
On eviction:
Tests have been added to ensure that the code is safe and correct.