[kernel:page_fault] add logging for new/swapped pages on page mapping

This commit is contained in:
ІО-23 Шмуляр Олег 2025-03-18 20:13:16 +02:00
parent b1b2d6903f
commit 92759f73a2
1 changed files with 29 additions and 1 deletions

View File

@ -141,11 +141,18 @@ KERNEL_page_fault(struct PageTableEntry *pt, size_t page_no)
if (first_free_page) {
free_pages_cnt--;
#if DISABLE_LOGGING != 1
printf("[kernel:page_fault] Found free page #%d, using it\n", first_free_page->ppn);
printf("[kernel:page_fault:free] Found free page #%d, using it\n", first_free_page->ppn);
#endif
pt[page_no].ppn = first_free_page->ppn;
pt[page_no].p = 1;
#if DISABLE_LOGGING != 1
if (pt[page_no].m)
printf("[kernel:page_fault:free] Loading page from swap\n");
else
printf("[kernel:page_fault:free] Creating fresh page\n");
#endif
first_free_page->busy_flag = 1;
first_free_page->pt = pt;
first_free_page->pt_index = page_no;
@ -198,6 +205,13 @@ KERNEL_page_fault(struct PageTableEntry *pt, size_t page_no)
pt[page_no].p = 1;
pt[page_no].ppn = first_busy_page->ppn;
#if DISABLE_LOGGING != 1
if (pt[page_no].m)
printf("[kernel:page_fault:random] Loading page from swap\n");
else
printf("[kernel:page_fault:random] Creating fresh page\n");
#endif
// move hand to next physical page
first_busy_page = first_busy_page->next;
@ -228,6 +242,13 @@ KERNEL_page_fault(struct PageTableEntry *pt, size_t page_no)
pt[page_no].p = 1;
pt[page_no].ppn = first_busy_page->ppn;
#if DISABLE_LOGGING != 1
if (pt[page_no].m)
printf("[kernel:page_fault:wsclock] Loading page from swap\n");
else
printf("[kernel:page_fault:wsclock] Creating fresh page\n");
#endif
first_busy_page = first_busy_page->next;
goto page_replacement_resolved;
@ -257,6 +278,13 @@ KERNEL_page_fault(struct PageTableEntry *pt, size_t page_no)
pt[page_no].p = 1;
pt[page_no].ppn = first_busy_page->ppn;
#if DISABLE_LOGGING != 1
if (pt[page_no].m)
printf("[kernel:page_fault:random] Loading page from swap\n");
else
printf("[kernel:page_fault:random] Creating fresh page\n");
#endif
// move hand to next physical page
first_busy_page = first_busy_page->next;