Skip to content

p36: Standardize PGSIZE to 4KB and integrate dynamic heap management#357

Open
2023cs50578 wants to merge 5 commits intocodenet:p31-umallocfrom
2023cs50578:p36-4kb-pages
Open

p36: Standardize PGSIZE to 4KB and integrate dynamic heap management#357
2023cs50578 wants to merge 5 commits intocodenet:p31-umallocfrom
2023cs50578:p36-4kb-pages

Conversation

@2023cs50578
Copy link
Copy Markdown

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 global PGSIZE from the legacy segmentation size (1MB) to the standard 4096 bytes. Removed the local #undef PGSIZE override in exec.c now that the global definition is correct.
  • proc.c (growproc): Rewrote the heap management logic. Instead of blindly increasing p->sz, growproc now explicitly requests physical page allocation/deallocation via allocuvm and deallocuvm. Added a switchuvm call to flush the hardware TLB when the page directory changes.

Boot-Path Reversions

  • main.c: With kalloc now dispensing 4KB pages, the setupkvm memory footprint is drastically reduced. Reverted the 128MB entrypgdir mapping expansion back to the standard 2-entry xv6-public configuration.
  • main.c (kinit1): Reverted the kinit1 initialization boundary back to 4MB, as the allocator now has plenty of granular pages to bootstrap the full kpgdir.

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.

2 participants