kernel/mm/buddy.c
void init_pages(unsigned int start_pfn, unsigned int end_pfn) {
    unsigned int i;
    for (i = start_pfn; i < end_pfn; i++) {
        clean_flag(pages + i, -1);
        set_flag(pages + i, _PAGE_ALLOCED);
        (pages + i)->reference = 1;
        (pages + i)->virtual = (void *)(-1);
        (pages + i)->bplevel = (-1);
        (pages + i)->slabp = 0;  // initially, the free space is the whole page
        INIT_LIST_HEAD(&(pages[i].list));
    }
}
// this function is to init all memory with page struct
this function is to init all memory with page struct
this function is to init all memory with page struct
void init_pages(unsigned int start_pfn, unsigned int end_pfn) {
    unsigned int i;
    for (i = start_pfn; i < end_pfn; i++) {
        clean_flag(pages + i, -1);
        set_flag(pages + i, _PAGE_ALLOCED);
        (pages + i)->reference = 1;
        (pages + i)->virtual = (void *)(-1);
        (pages + i)->bplevel = (-1);
        (pages + i)->slabp = 0;  
        INIT_LIST_HEAD(&(pages[i].list));
    }
}
void init_pages ( unsigned int start_pfn , unsigned int end_pfn ) { unsigned int i ; for ( i = start_pfn ; i < end_pfn ; i ++ ) { clean_flag ( pages + i , -1 ) ; set_flag ( pages + i , _PAGE_ALLOCED ) ; ( pages + i ) -> reference = 1 ; ( pages + i ) -> virtual = ( void * ) ( -1 ) ; ( pages + i ) -> bplevel = ( -1 ) ; ( pages + i ) -> slabp = 0 ; INIT_LIST_HEAD ( & ( pages [ i ] . list ) ) ; } }
this function is to init all memory with page struct
this function is to init all memory with page struct
// initially, the free space is the whole page