Skip to content

Commit

Permalink
Merge pull request #442 from joergroedel/pgtable-stack-usage
Browse files Browse the repository at this point in the history
kernel/mm: Reduce stack footprint of page-table freeing
  • Loading branch information
joergroedel authored Aug 21, 2024
2 parents 3280b5f + 0919907 commit cd91a0d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/src/mm/pagetable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,8 @@ struct RawPageTablePart {
impl RawPageTablePart {
/// Frees a level 1 page table.
fn free_lvl1(page: &PTPage) {
for entry in page.entries {
if let Some(page) = PTPage::from_entry(entry) {
for entry in page.entries.iter() {
if let Some(page) = PTPage::from_entry(*entry) {
// SAFETY: the page comes from an entry in the page table,
// which we allocated using `PTPage::alloc()`, so this is
// safe.
Expand All @@ -989,8 +989,8 @@ impl RawPageTablePart {

/// Frees a level 2 page table, including all level 1 tables beneath it.
fn free_lvl2(page: &PTPage) {
for entry in page.entries {
if let Some(l1_page) = PTPage::from_entry(entry) {
for entry in page.entries.iter() {
if let Some(l1_page) = PTPage::from_entry(*entry) {
Self::free_lvl1(l1_page);
// SAFETY: the page comes from an entry in the page table,
// which we allocated using `PTPage::alloc()`, so this is
Expand Down

0 comments on commit cd91a0d

Please sign in to comment.