aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2005-10-29 21:16:22 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 00:40:40 -0400
commit1bb3630e89cb8a7b3d3807629c20c5bad88290ff (patch)
tree3d1fd73487ca66f227701b9530f2c76fcc6f9da4 /include
parent872fec16d9a0ed3b75b8893aa217e49cca575ee5 (diff)
[PATCH] mm: ptd_alloc inline and out
It seems odd to me that, whereas pud_alloc and pmd_alloc test inline, only calling out-of-line __pud_alloc __pmd_alloc if allocation needed, pte_alloc_map and pte_alloc_kernel are entirely out-of-line. Though it does add a little to kernel size, change them to macros testing inline, calling __pte_alloc or __pte_alloc_kernel to allocate out-of-line. Mark none of them as fastcalls, leave that to CONFIG_REGPARM or not. It also seems more natural for the out-of-line functions to leave the offset calculation and map to the inline, which has to do it anyway for the common case. At least mremap move wants __pte_alloc without _map. Macros rather than inline functions, certainly to avoid the header file issues which arise from CONFIG_HIGHPTE needing kmap_types.h, but also in case any architectures I haven't built would have other such problems. Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/4level-fixup.h11
-rw-r--r--include/linux/mm.h38
2 files changed, 22 insertions, 27 deletions
diff --git a/include/asm-generic/4level-fixup.h b/include/asm-generic/4level-fixup.h
index c20ec257ecc0..68c6fea994d9 100644
--- a/include/asm-generic/4level-fixup.h
+++ b/include/asm-generic/4level-fixup.h
@@ -10,14 +10,9 @@
10 10
11#define pud_t pgd_t 11#define pud_t pgd_t
12 12
13#define pmd_alloc(mm, pud, address) \ 13#define pmd_alloc(mm, pud, address) \
14({ pmd_t *ret; \ 14 ((unlikely(pgd_none(*(pud))) && __pmd_alloc(mm, pud, address))? \
15 if (pgd_none(*pud)) \ 15 NULL: pmd_offset(pud, address))
16 ret = __pmd_alloc(mm, pud, address); \
17 else \
18 ret = pmd_offset(pud, address); \
19 ret; \
20})
21 16
22#define pud_alloc(mm, pgd, address) (pgd) 17#define pud_alloc(mm, pgd, address) (pgd)
23#define pud_offset(pgd, start) (pgd) 18#define pud_offset(pgd, start) (pgd)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index b9fa82b96d9e..22c2d6922c0e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -704,10 +704,6 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
704} 704}
705 705
706extern int vmtruncate(struct inode * inode, loff_t offset); 706extern int vmtruncate(struct inode * inode, loff_t offset);
707extern pud_t *FASTCALL(__pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address));
708extern pmd_t *FASTCALL(__pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address));
709extern pte_t *FASTCALL(pte_alloc_kernel(pmd_t *pmd, unsigned long address));
710extern pte_t *FASTCALL(pte_alloc_map(struct mm_struct *mm, pmd_t *pmd, unsigned long address));
711extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot); 707extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot);
712extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot); 708extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot);
713extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access); 709extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access);
@@ -760,32 +756,36 @@ struct shrinker;
760extern struct shrinker *set_shrinker(int, shrinker_t); 756extern struct shrinker *set_shrinker(int, shrinker_t);
761extern void remove_shrinker(struct shrinker *shrinker); 757extern void remove_shrinker(struct shrinker *shrinker);
762 758
763/* 759int __pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address);
764 * On a two-level or three-level page table, this ends up being trivial. Thus 760int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address);
765 * the inlining and the symmetry break with pte_alloc_map() that does all 761int __pte_alloc(struct mm_struct *mm, pmd_t *pmd, unsigned long address);
766 * of this out-of-line. 762int __pte_alloc_kernel(pmd_t *pmd, unsigned long address);
767 */ 763
768/* 764/*
769 * The following ifdef needed to get the 4level-fixup.h header to work. 765 * The following ifdef needed to get the 4level-fixup.h header to work.
770 * Remove it when 4level-fixup.h has been removed. 766 * Remove it when 4level-fixup.h has been removed.
771 */ 767 */
772#ifdef CONFIG_MMU 768#if defined(CONFIG_MMU) && !defined(__ARCH_HAS_4LEVEL_HACK)
773#ifndef __ARCH_HAS_4LEVEL_HACK
774static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address) 769static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
775{ 770{
776 if (pgd_none(*pgd)) 771 return (unlikely(pgd_none(*pgd)) && __pud_alloc(mm, pgd, address))?
777 return __pud_alloc(mm, pgd, address); 772 NULL: pud_offset(pgd, address);
778 return pud_offset(pgd, address);
779} 773}
780 774
781static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address) 775static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
782{ 776{
783 if (pud_none(*pud)) 777 return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address))?
784 return __pmd_alloc(mm, pud, address); 778 NULL: pmd_offset(pud, address);
785 return pmd_offset(pud, address);
786} 779}
787#endif 780#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */
788#endif /* CONFIG_MMU */ 781
782#define pte_alloc_map(mm, pmd, address) \
783 ((unlikely(!pmd_present(*(pmd))) && __pte_alloc(mm, pmd, address))? \
784 NULL: pte_offset_map(pmd, address))
785
786#define pte_alloc_kernel(pmd, address) \
787 ((unlikely(!pmd_present(*(pmd))) && __pte_alloc_kernel(pmd, address))? \
788 NULL: pte_offset_kernel(pmd, address))
789 789
790extern void free_area_init(unsigned long * zones_size); 790extern void free_area_init(unsigned long * zones_size);
791extern void free_area_init_node(int nid, pg_data_t *pgdat, 791extern void free_area_init_node(int nid, pg_data_t *pgdat,