/* * Called when the last reference to the mm * is dropped: either by a lazy thread or by * mmput. Free the page directory and the mm. */ inline void __mmdrop(struct mm_struct *mm) { if (mm->ioctx_list) BUG(); if (mm == &init_mm) BUG(); pgd_free(mm->pgd); destroy_context(mm); free_mm(mm); }
/* * This function frees up all page tables of a process when it exits. It * is the same as "clear_page_tables()", except it also changes the process' * page table directory to the kernel page tables and then frees the old * page table directory. */ void free_page_tables(struct mm_struct * mm) { int i; pgd_t * page_dir; page_dir = mm->pgd; if (!page_dir || page_dir == swapper_pg_dir) { printk("Trying to free kernel page-directory: not good\n"); return; } #ifndef CONFIG_BESTA for (i = 0 ; i < USER_PTRS_PER_PGD ; i++) free_one_pgd(page_dir + i); #else for (i = 0 ; i < PTRS_PER_PGD ; i++) free_one_pgd(page_dir + i); #endif pgd_free(page_dir); }
static inline void mm_free_pgd(struct mm_struct *mm) { #ifdef CONFIG_TIMA_RKP_DEBUG int i; #endif pgd_free(mm, mm->pgd); #ifdef CONFIG_TIMA_RKP_DEBUG /* with debug infrastructure, check if a page was * unprotected after being freed. Scream if not. */ #ifdef CONFIG_TIMA_RKP_L1_TABLES for(i=0; i<4; i++) { if (tima_debug_page_protection(((unsigned long)mm->pgd + i*0x1000), 5, 0) == 1) { tima_debug_signal_failure(0x3f80f221, 5); //tima_send_cmd((unsigned long)mm->pgd, 0x3f80e221); //printk(KERN_ERR"TIMA: New L1 PGT still protected! mm_free_pgd\n"); } } #endif #endif }
static inline void mm_free_pgd(struct mm_struct * mm) { pgd_free(mm->pgd); }