From: NIIBE Y. <gn...@m1...> - 2002-03-22 02:46:02
|
Other follow-up to 2.5.5. 2002-03-22 NIIBE Yutaka <gn...@m1...> * arch/sh/kernel/process.c (cpu_idle): Don't call check_pgt_cache. * include/asm-sh/pgalloc.h (pmd_populate_kernel): Renemed from pmd_populate. (pmd_populate): New function for U0 page. (do_check_pgt_cache): Removed. (pmd_free_slow, pmd_free_fast): Removed. (pmd_alloc_one_fast): Removed. (pte_free_slow): Renamed to pte_free. Macro removed. (pte_alloc_one_fast): Removed. (pte_alloc_one_kernel): New function. (pte_alloc_one): Call schedule_timeout and try again. Index: arch/sh/kernel/process.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/process.c,v retrieving revision 1.6 diff -u -3 -p -r1.6 process.c --- arch/sh/kernel/process.c 19 Mar 2002 23:48:06 -0000 1.6 +++ arch/sh/kernel/process.c 22 Mar 2002 02:42:15 -0000 @@ -55,7 +55,6 @@ void cpu_idle(void *unused) __sti(); } schedule(); - check_pgt_cache(); } } Index: include/asm-sh/pgalloc.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/asm-sh/pgalloc.h,v retrieving revision 1.2 diff -u -3 -p -r1.2 pgalloc.h --- include/asm-sh/pgalloc.h 24 Jan 2002 11:04:15 -0000 1.2 +++ include/asm-sh/pgalloc.h 22 Mar 2002 02:42:15 -0000 @@ -10,9 +10,15 @@ #define pte_quicklist ((unsigned long *)0) #define pgtable_cache_size 0L -#define pmd_populate(mm, pmd, pte) \ +#define pmd_populate_kernel(mm, pmd, pte) \ set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) +static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, + struct page *pte) +{ + set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte))); +} + /* * Allocate and free page tables. */ @@ -33,43 +39,58 @@ static inline void pgd_free(pgd_t *pgd) kfree(pgd); } -static inline pte_t *pte_alloc_one(struct mm_struct *mm, unsigned long address) +static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) { - pte_t *pte = (pte_t *) __get_free_page(GFP_KERNEL); - if (pte) - clear_page(pte); + int count = 0; + pte_t *pte; + + do { + pte = (pte_t *) __get_free_page(GFP_KERNEL); + if (pte) + clear_page(pte); + else { + current->state = TASK_UNINTERRUPTIBLE; + schedule_timeout(HZ); + } + } while (!pte && (count++ < 10)); return pte; } -static inline pte_t *pte_alloc_one_fast(struct mm_struct *mm, unsigned long address) +static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) { - return 0; + int count = 0; + struct page *pte; + + do { + pte = alloc_pages(GFP_KERNEL, 0); + if (pte) + clear_page(pte); + else { + current->state = TASK_UNINTERRUPTIBLE; + schedule_timeout(HZ); + } + } while (!pte && (count++ < 10)); + return pte; } -static inline void pte_free_slow(pte_t *pte) +static inline void pte_free_kernel(pte_t *pte) { free_page((unsigned long)pte); } -#define pte_free(pte) pte_free_slow(pte) +static inline void pte_free(struct page *pte) +{ + __free_page(pte); +} /* * allocating and freeing a pmd is trivial: the 1-entry pmd is * inside the pgd, so has no extra memory associated with it. */ -static inline void pmd_free(pmd_t * pmd) -{ -} -#define pmd_alloc_one_fast(mm, addr) ({ BUG(); ((pmd_t *)1); }) #define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); }) -#define pmd_free_slow(x) do { } while (0) -#define pmd_free_fast(x) do { } while (0) #define pmd_free(x) do { } while (0) #define pgd_populate(mm, pmd, pte) BUG() - -/* Do nothing */ -static inline int do_check_pgt_cache(int low, int high) { } /* * TLB flushing: |
From: NIIBE Y. <gn...@m1...> - 2002-03-22 03:57:23
|
More follow-up to 2.5.5. 2002-03-22 NIIBE Yutaka <gn...@se...> * include/asm-sh/pgtable.h (pmd_page_kernel): Renamed from pmd_page. (pmd_page): New macro for user page. (pte_offset_kernel): New macro. (pte_offset_map, pte_offset_map_nested, pte_unmap, pte_unmap_nested): New macros. * arch/sh/mm/ioremap.c (remap_area_pmd): Use pte_alloc_kernel (was: pte_alloc). Index: arch/sh/mm/ioremap.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/mm/ioremap.c,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 ioremap.c --- arch/sh/mm/ioremap.c 15 Oct 2001 20:44:54 -0000 1.1.1.1 +++ arch/sh/mm/ioremap.c 22 Mar 2002 03:47:36 -0000 @@ -52,7 +52,7 @@ static inline int remap_area_pmd(pmd_t * if (address >= end) BUG(); do { - pte_t * pte = pte_alloc(&init_mm, pmd, address); + pte_t * pte = pte_alloc_kernel(&init_mm, pmd, address); if (!pte) return -ENOMEM; remap_area_pte(pte, address, end - address, address + phys_addr, flags); Index: include/asm-sh/pgtable.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/asm-sh/pgtable.h,v retrieving revision 1.5 diff -u -3 -p -r1.5 pgtable.h --- include/asm-sh/pgtable.h 22 Mar 2002 00:59:15 -0000 1.5 +++ include/asm-sh/pgtable.h 22 Mar 2002 03:47:36 -0000 @@ -269,9 +271,12 @@ static inline pte_t pte_modify(pte_t pte #define page_pte(page) page_pte_prot(page, __pgprot(0)) -#define pmd_page(pmd) \ +#define pmd_page_kernel(pmd) \ ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) +#define pmd_page(pmd) \ + (phys_to_page(pmd_val(pmd))) + /* to find an entry in a page-table-directory. */ #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) #define __pgd_offset(address) pgd_index(address) @@ -283,8 +288,13 @@ static inline pte_t pte_modify(pte_t pte /* Find an entry in the third-level page table.. */ #define __pte_offset(address) \ ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) -#define pte_offset(dir, address) ((pte_t *) pmd_page(*(dir)) + \ - __pte_offset(address)) +#define pte_offset_kernel(dir, address) \ + ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) +#define pte_offset_map(dir, address) \ + ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) +#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) +#define pte_unmap(pte) do { } while (0) +#define pte_unmap_nested(pte) do { } while (0) extern void update_mmu_cache(struct vm_area_struct * vma, unsigned long address, pte_t pte); |