p36: Standardize PGSIZE to 4KB and integrate dynamic heap management#357
Open
2023cs50578 wants to merge 5 commits intocodenet:p31-umallocfrom
Open
p36: Standardize PGSIZE to 4KB and integrate dynamic heap management#3572023cs50578 wants to merge 5 commits intocodenet:p31-umallocfrom
2023cs50578 wants to merge 5 commits intocodenet:p31-umallocfrom
Conversation
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.
Objective
This branch pays off the technical debt from the high-half migration by standardizing the OS to a 4KB page resolution. It removes the intermediate boot hacks required by the legacy 1MB page size and fully wires the user-space heap allocation system (
sbrk) to the hardware paging utilities.Core Changes
mmu.h&exec.c: Redefined the globalPGSIZEfrom the legacy segmentation size (1MB) to the standard4096bytes. Removed the local#undef PGSIZEoverride inexec.cnow that the global definition is correct.proc.c(growproc): Rewrote the heap management logic. Instead of blindly increasingp->sz,growprocnow explicitly requests physical page allocation/deallocation viaallocuvmanddeallocuvm. Added aswitchuvmcall to flush the hardware TLB when the page directory changes.Boot-Path Reversions
main.c: Withkallocnow dispensing 4KB pages, thesetupkvmmemory footprint is drastically reduced. Reverted the 128MBentrypgdirmapping expansion back to the standard 2-entryxv6-publicconfiguration.main.c(kinit1): Reverted thekinit1initialization boundary back to4MB, as the allocator now has plenty of granular pages to bootstrap the fullkpgdir.