From 68b5a30ff3f3bd193ab1c824b7dc9ed464988a41 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 20 Apr 2003 00:28:25 -0700 Subject: [PATCH] use __GFP_REPEAT in pte_alloc_one() Remove all the open-coded retry loops in various architectures, use __GFP_REPEAT. It could be that at some time in the future we change __GFP_REPEAT to give up after ten seconds or so, so all the checks for failed allocations are retained. --- include/asm-ia64/pgalloc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/asm-ia64/pgalloc.h') diff --git a/include/asm-ia64/pgalloc.h b/include/asm-ia64/pgalloc.h index 2e6134af88bc..00847acab313 100644 --- a/include/asm-ia64/pgalloc.h +++ b/include/asm-ia64/pgalloc.h @@ -125,7 +125,7 @@ pmd_populate_kernel (struct mm_struct *mm, pmd_t *pmd_entry, pte_t *pte) static inline struct page * pte_alloc_one (struct mm_struct *mm, unsigned long addr) { - struct page *pte = alloc_pages(GFP_KERNEL, 0); + struct page *pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0); if (likely(pte != NULL)) clear_page(page_address(pte)); @@ -135,7 +135,7 @@ pte_alloc_one (struct mm_struct *mm, unsigned long addr) static inline pte_t * pte_alloc_one_kernel (struct mm_struct *mm, unsigned long addr) { - pte_t *pte = (pte_t *) __get_free_page(GFP_KERNEL); + pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); if (likely(pte != NULL)) clear_page(pte); -- cgit v1.2.3 From 36f6aa1b67f4387ef8d50ad060207df04f007ffd Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 20 Apr 2003 00:28:32 -0700 Subject: [PATCH] use __GFP_REPEAT in pmd_alloc_one() Convert all pmd_alloc_one() implementations to use __GFP_REPEAT --- arch/sparc/mm/sun4c.c | 2 +- include/asm-alpha/pgalloc.h | 2 +- include/asm-ia64/pgalloc.h | 2 +- include/asm-m68k/sun3_pgalloc.h | 2 +- include/asm-mips64/pgalloc.h | 2 +- include/asm-parisc/pgalloc.h | 2 +- include/asm-ppc64/pgalloc.h | 14 +++----------- include/asm-sparc64/pgalloc.h | 2 +- include/asm-x86_64/pgalloc.h | 4 ++-- 9 files changed, 12 insertions(+), 20 deletions(-) (limited to 'include/asm-ia64/pgalloc.h') diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index e4da22250441..13495f4c418f 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c @@ -2194,7 +2194,7 @@ void __init ld_mmu_sun4c(void) BTFIXUPSET_CALL(pte_alloc_one_kernel, sun4c_pte_alloc_one_kernel, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(pte_alloc_one, sun4c_pte_alloc_one, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(free_pmd_fast, sun4c_free_pmd_fast, BTFIXUPCALL_NOP); - BTFIXUPSET_CALL(pmd_alloc_one, sun4c_pmd_alloc_one, BTFIXUPCALL_RETO0); + BTFIXUPSET_CALL(pmd_alloc_one, sun4c_lpmd_alloc_one, BTFIXUPCALL_RETO0); BTFIXUPSET_CALL(free_pgd_fast, sun4c_free_pgd_fast, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(get_pgd_fast, sun4c_get_pgd_fast, BTFIXUPCALL_NORM); diff --git a/include/asm-alpha/pgalloc.h b/include/asm-alpha/pgalloc.h index fc675efac381..b34194c3d96c 100644 --- a/include/asm-alpha/pgalloc.h +++ b/include/asm-alpha/pgalloc.h @@ -40,7 +40,7 @@ pgd_free(pgd_t *pgd) static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long address) { - pmd_t *ret = (pmd_t *)__get_free_page(GFP_KERNEL); + pmd_t *ret = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); if (ret) clear_page(ret); return ret; diff --git a/include/asm-ia64/pgalloc.h b/include/asm-ia64/pgalloc.h index 00847acab313..4f56ceb9c42b 100644 --- a/include/asm-ia64/pgalloc.h +++ b/include/asm-ia64/pgalloc.h @@ -93,7 +93,7 @@ pmd_alloc_one_fast (struct mm_struct *mm, unsigned long addr) static inline pmd_t* pmd_alloc_one (struct mm_struct *mm, unsigned long addr) { - pmd_t *pmd = (pmd_t *) __get_free_page(GFP_KERNEL); + pmd_t *pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); if (likely(pmd != NULL)) clear_page(pmd); diff --git a/include/asm-m68k/sun3_pgalloc.h b/include/asm-m68k/sun3_pgalloc.h index 3b7f6cc2d38c..4580b60196b9 100644 --- a/include/asm-m68k/sun3_pgalloc.h +++ b/include/asm-m68k/sun3_pgalloc.h @@ -18,7 +18,7 @@ extern const char bad_pmd_string[]; -#define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) +#define lpmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) static inline void pte_free_kernel(pte_t * pte) diff --git a/include/asm-mips64/pgalloc.h b/include/asm-mips64/pgalloc.h index a3113072d611..2b777eebcc31 100644 --- a/include/asm-mips64/pgalloc.h +++ b/include/asm-mips64/pgalloc.h @@ -141,7 +141,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) { pmd_t *pmd; - pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, 1); + pmd = (pmd_t *)__get_free_pages(GFP_KERNEL|__GFP_REPEAT, 1); if (pmd) pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table); return pmd; diff --git a/include/asm-parisc/pgalloc.h b/include/asm-parisc/pgalloc.h index 14c8605f46a5..bbc02cb134b7 100644 --- a/include/asm-parisc/pgalloc.h +++ b/include/asm-parisc/pgalloc.h @@ -35,7 +35,7 @@ static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd) static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) { - pmd_t *pmd = (pmd_t *) __get_free_page(GFP_KERNEL); + pmd_t *pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); if (pmd) clear_page(pmd); return pmd; diff --git a/include/asm-ppc64/pgalloc.h b/include/asm-ppc64/pgalloc.h index 40361c23d924..9376b791bee7 100644 --- a/include/asm-ppc64/pgalloc.h +++ b/include/asm-ppc64/pgalloc.h @@ -31,19 +31,11 @@ pgd_free(pgd_t *pgd) static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long addr) { - int count = 0; pmd_t *pmd; - do { - pmd = (pmd_t *)__get_free_page(GFP_KERNEL); - if (pmd) - clear_page(pmd); - else { - current->state = TASK_UNINTERRUPTIBLE; - schedule_timeout(HZ); - } - } while (!pmd && (count++ < 10)); - + pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); + if (pmd) + clear_page(pmd); return pmd; } diff --git a/include/asm-sparc64/pgalloc.h b/include/asm-sparc64/pgalloc.h index 037c09b1a737..d3c3a7060664 100644 --- a/include/asm-sparc64/pgalloc.h +++ b/include/asm-sparc64/pgalloc.h @@ -159,7 +159,7 @@ static __inline__ pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addre pmd = pmd_alloc_one_fast(mm, address); if (!pmd) { - pmd = (pmd_t *)__get_free_page(GFP_KERNEL); + pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); if (pmd) memset(pmd, 0, PAGE_SIZE); } diff --git a/include/asm-x86_64/pgalloc.h b/include/asm-x86_64/pgalloc.h index 65b817702a16..e15895c99a4e 100644 --- a/include/asm-x86_64/pgalloc.h +++ b/include/asm-x86_64/pgalloc.h @@ -31,12 +31,12 @@ extern __inline__ void pmd_free(pmd_t *pmd) static inline pmd_t *pmd_alloc_one (struct mm_struct *mm, unsigned long addr) { - return (pmd_t *) get_zeroed_page(GFP_KERNEL); + return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); } static inline pgd_t *pgd_alloc (struct mm_struct *mm) { - return (pgd_t *)get_zeroed_page(GFP_KERNEL); + return (pgd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); } static inline void pgd_free (pgd_t *pgd) -- cgit v1.2.3