Skip to content

Commit

Permalink
pmm: Mark as free BEFORE returning.
Browse files Browse the repository at this point in the history
Signed-off-by: TunaCici <[email protected]>
  • Loading branch information
TunaCici committed Jan 7, 2024
1 parent 02e6f32 commit e21de1e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Kernel/Memory/Physical.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,16 @@ void free_pages(void *targetAddr, const uint32_t order)
return;
}

/* Mark as free */
BUDDY_MARK_FREE(buddyPmm[order].map, targetIdx);

/* 2^(MAX_ORDER - 1) block don't coalese */
if (order == (MAX_ORDER - 1)) {
klog("[pmm] 2^(MAX_ORDER - 1) block don't coalese. append\n");
__append_to_order(order, targetAddr);
return;
}

/* Mark as free */
BUDDY_MARK_FREE(buddyPmm[order].map, targetIdx);

/* Coalese? */
for (uint32_t currOrder = order; currOrder < MAX_ORDER - 1; currOrder++) {
list_head_t *buddy = __buddy(targetAddr, currOrder);
Expand Down

0 comments on commit e21de1e

Please sign in to comment.