x86: add alloc/release_pud; more demacroing
Subsystems (4)
PATCH 1/1 x86/pgtable.h: demacro ptep_set_access_flags
In reply to Jeremy Fitzhardinge--- include/asm-x86/pgtable.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
include/asm-x86/pgtable.h +14 -10
@@ -287,6 +287,8 @@#define pte_update_defer (mm, addr, ptep) do { } while (0)#endif +#include <asm/tlbflush.h> +/* * We only update the dirty/accessed state if we set * the dirty bit by hand in the kernel, since the hardware
@@ -295,16 +297,18 @@* bit at the same time. */ #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS -#define ptep_set_access_flags (vma, address, ptep, entry, dirty) \ -({ \ - int __changed = !pte_same(*(ptep), entry); \ - if (__changed && dirty) { \ - *ptep = entry; \ - pte_update_defer((vma)->vm_mm, (address), (ptep)); \ - flush_tlb_page(vma, address); \ - } \ - __changed; \ -}) +static inline int ptep_set_access_flags (struct vm_area_struct *vma, +unsigned long address,pte_t *ptep, +pte_t entry,int dirty) +{ +int changed = !pte_same (*ptep, entry); +if (changed && dirty) { + *ptep = entry; +pte_update_defer (vma->vm_mm, address, ptep); +flush_tlb_page (vma, address); + } +return changed; +}#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG#define ptep_test_and_clear_young (vma, addr, ptep) ({ \
PATCH 1/1 x86: add alloc/release_pud; more demacroing
Hi Ingo,
This series:
1. Renames the alloc/release_{pt,pd} calls to _pte, _pmd so that its clear what they operate on.
2. Adds alloc/release_pud, and puts calls in the appropriate places
3. Demacros some stuff in pgtable.h
A bit eclectic, but all fairly straightforward (and no changes to non-x86 headers ;).
Thanks,
J
PATCH 1/1 x86: add pud_alloc for 4-level pagetables
--- arch/x86/kernel/paravirt.c | 2 ++ arch/x86/mm/pgtable.c | 1 + include/asm-x86/paravirt.h | 11 +++++++++++ include/asm-x86/pgalloc.h | 3 +++ 4 files changed, 17 insertions(+)
arch/x86/kernel/paravirt.c +2 -0
@@ -385,8 +385,10 @@ .alloc_pte = paravirt_nop, .alloc_pmd = paravirt_nop, .alloc_pmd_clone = paravirt_nop, + .alloc_pud = paravirt_nop, .release_pte = paravirt_nop, .release_pmd = paravirt_nop, + .release_pud = paravirt_nop, .set_pte = native_set_pte, .set_pte_at = native_set_pte_at,
arch/x86/mm/pgtable.c +1 -0
@@ -34,6 +34,7 @@#if PAGETABLE_LEVELS >3 void __pud_free_tlb (struct mmu_gather *tlb,pud_t *pud) { +paravirt_release_pud (__pa (pud) >>PAGE_SHIFT );tlb_remove_page (tlb,virt_to_page (pud)); }#endif /* PAGETABLE_LEVELS > 3 */
include/asm-x86/paravirt.h +11 -0
@@ -223,8 +223,10 @@void (*alloc_pte)(struct mm_struct *mm,u32 pfn);void (*alloc_pmd)(struct mm_struct *mm,u32 pfn);void (*alloc_pmd_clone)(u32 pfn,u32 clonepfn,u32 start,u32 count); +void (*alloc_pud)(struct mm_struct *mm,u32 pfn);void (*release_pte)(u32 pfn);void (*release_pmd)(u32 pfn); +void (*release_pud)(u32 pfn);/* Pagetable manipulation functions */ void (*set_pte)(pte_t *ptep,pte_t pteval);
@@ -918,6 +920,15 @@PVOP_VCALL1 (pv_mmu_ops.release_pmd, pfn); } +static inline void paravirt_alloc_pud (struct mm_struct *mm,unsigned pfn) +{ +PVOP_VCALL2 (pv_mmu_ops.alloc_pud, mm, pfn); +} +static inline void paravirt_release_pud (unsigned pfn) +{ +PVOP_VCALL1 (pv_mmu_ops.release_pud, pfn); +} +#ifdef CONFIG_HIGHPTE static inline void *kmap_atomic_pte (struct page *page,enum km_type type) {
include/asm-x86/pgalloc.h +3 -0
@@ -11,8 +11,10 @@#define paravirt_alloc_pte (mm, pfn) do { } while (0)#define paravirt_alloc_pmd (mm, pfn) do { } while (0)#define paravirt_alloc_pmd_clone (pfn, clonepfn, start, count) do { } while (0) +#define paravirt_alloc_pud (mm, pfn) do { } while (0)#define paravirt_release_pte (pfn) do { } while (0)#define paravirt_release_pmd (pfn) do { } while (0) +#define paravirt_release_pud (pfn) do { } while (0)#endif /*
@@ -93,6 +95,7 @@#if PAGETABLE_LEVELS >3 static inline void pgd_populate (struct mm_struct *mm,pgd_t *pgd,pud_t *pud) { +paravirt_alloc_pud (mm,__pa (pud) >>PAGE_SHIFT );set_pgd (pgd,__pgd (_PAGE_TABLE |__pa (pud))); }
PATCH 1/1 x86/pgtable.h: demacro ptep_test_and_clear_young
In reply to Jeremy Fitzhardinge--- include/asm-x86/pgtable.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
include/asm-x86/pgtable.h +11 -9
@@ -311,15 +311,17 @@ }#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG -#define ptep_test_and_clear_young (vma, addr, ptep) ({ \ - int __ret = 0; \ - if (pte_young(*(ptep))) \ - __ret = test_and_clear_bit(_PAGE_BIT_ACCESSED, \ - &(ptep)->pte); \ - if (__ret) \ - pte_update((vma)->vm_mm, addr, ptep); \ - __ret; \ -}) +static inline int ptep_test_and_clear_young (struct vm_area_struct *vma, +unsigned long addr,pte_t *ptep) +{ +int ret =0 ; +if (pte_young (*ptep)) + ret =test_and_clear_bit (_PAGE_BIT_ACCESSED, + &ptep->pte); +if (ret) +pte_update (vma->vm_mm, addr, ptep); +return ret; +}#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH#define ptep_clear_flush_young (vma, address, ptep) \
PATCH 1/1 x86/pgtable.h: demacro ptep_clear_flush_young
In reply to Jeremy Fitzhardinge--- include/asm-x86/pgtable.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
include/asm-x86/pgtable.h +9 -8
@@ -324,14 +324,15 @@ }#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH -#define ptep_clear_flush_young (vma, address, ptep) \ -({ \ - int __young; \ - __young = ptep_test_and_clear_young((vma), (address), (ptep)); \ - if (__young) \ - flush_tlb_page(vma, address); \ - __young; \ -}) +static inline int ptep_clear_flush_young (struct vm_area_struct *vma, +unsigned long address,pte_t *ptep) +{ +int young; + young =ptep_test_and_clear_young (vma, address, ptep); +if (young) +flush_tlb_page (vma, address); +return young; +}#define __HAVE_ARCH_PTEP_GET_AND_CLEARstatic inline pte_t ptep_get_and_clear (struct mm_struct *mm,unsigned long addr,pte_t *ptep)
PATCH 1/1 x86: rename paravirt_alloc_pt etc after the pagetable structure
In reply to Jeremy FitzhardingeRename (alloc|release)_(pt|pd) to pte/pmd to explicitly match the name of the appropriate pagetable level structure.
--- arch/x86/kernel/paravirt.c | 10 +++++----- arch/x86/kernel/vmi_32.c | 20 ++++++++++---------- arch/x86/mm/init_32.c | 6 +++--- arch/x86/mm/ioremap.c | 2 +- arch/x86/mm/pageattr.c | 2 +- arch/x86/mm/pgtable.c | 16 ++++++++-------- arch/x86/xen/enlighten.c | 30 +++++++++++++++--------------- include/asm-x86/paravirt.h | 32 ++++++++++++++++---------------- include/asm-x86/pgalloc.h | 16 ++++++++-------- 9 files changed, 67 insertions(+), 67 deletions(-)
arch/x86/kernel/paravirt.c +5 -5
@@ -382,11 +382,11 @@ .flush_tlb_single = native_flush_tlb_single, .flush_tlb_others = native_flush_tlb_others, - .alloc_pt = paravirt_nop, - .alloc_pd = paravirt_nop, - .alloc_pd_clone = paravirt_nop, - .release_pt = paravirt_nop, - .release_pd = paravirt_nop, + .alloc_pte = paravirt_nop, + .alloc_pmd = paravirt_nop, + .alloc_pmd_clone = paravirt_nop, + .release_pte = paravirt_nop, + .release_pmd = paravirt_nop, .set_pte = native_set_pte, .set_pte_at = native_set_pte_at,
arch/x86/kernel/vmi_32.c +10 -10
@@ -392,13 +392,13 @@ }#endif -static void vmi_allocate_pt (struct mm_struct *mm,u32 pfn) +static void vmi_allocate_pte (struct mm_struct *mm,u32 pfn) {vmi_set_page_type (pfn,VMI_PAGE_L1 ); vmi_ops.allocate_page (pfn,VMI_PAGE_L1 ,0 ,0 ,0 ); } -static void vmi_allocate_pd (struct mm_struct *mm,u32 pfn) +static void vmi_allocate_pmd (struct mm_struct *mm,u32 pfn) {/* * This call comes in very early, before mem_map is setup.
@@ -409,20 +409,20 @@ vmi_ops.allocate_page (pfn,VMI_PAGE_L2 ,0 ,0 ,0 ); } -static void vmi_allocate_pd_clone (u32 pfn,u32 clonepfn,u32 start,u32 count) +static void vmi_allocate_pmd_clone (u32 pfn,u32 clonepfn,u32 start,u32 count) {vmi_set_page_type (pfn,VMI_PAGE_L2 |VMI_PAGE_CLONE );vmi_check_page_type (clonepfn,VMI_PAGE_L2 ); vmi_ops.allocate_page (pfn,VMI_PAGE_L2 |VMI_PAGE_CLONE , clonepfn, start, count); } -static void vmi_release_pt (u32 pfn) +static void vmi_release_pte (u32 pfn) { vmi_ops.release_page (pfn,VMI_PAGE_L1 );vmi_set_page_type (pfn,VMI_PAGE_NORMAL ); } -static void vmi_release_pd (u32 pfn) +static void vmi_release_pmd (u32 pfn) { vmi_ops.release_page (pfn,VMI_PAGE_L2 );vmi_set_page_type (pfn,VMI_PAGE_NORMAL );
@@ -871,15 +871,15 @@ vmi_ops.allocate_page =vmi_get_function (VMI_CALL_AllocatePage);if (vmi_ops.allocate_page) { - pv_mmu_ops.alloc_pt = vmi_allocate_pt; - pv_mmu_ops.alloc_pd = vmi_allocate_pd; - pv_mmu_ops.alloc_pd_clone = vmi_allocate_pd_clone; + pv_mmu_ops.alloc_pte = vmi_allocate_pte; + pv_mmu_ops.alloc_pmd = vmi_allocate_pmd; + pv_mmu_ops.alloc_pmd_clone = vmi_allocate_pmd_clone; } vmi_ops.release_page =vmi_get_function (VMI_CALL_ReleasePage);if (vmi_ops.release_page) { - pv_mmu_ops.release_pt = vmi_release_pt; - pv_mmu_ops.release_pd = vmi_release_pd; + pv_mmu_ops.release_pte = vmi_release_pte; + pv_mmu_ops.release_pmd = vmi_release_pmd; }/* Set linear is needed in all cases */
arch/x86/mm/init_32.c +3 -3
@@ -68,7 +68,7 @@if (!(pgd_val (*pgd) & _PAGE_PRESENT)) { pmd_table = (pmd_t *)alloc_bootmem_low_pages (PAGE_SIZE ); -paravirt_alloc_pd (&init_mm,__pa (pmd_table) >>PAGE_SHIFT ); +paravirt_alloc_pmd (&init_mm,__pa (pmd_table) >>PAGE_SHIFT );set_pgd (pgd,__pgd (__pa (pmd_table) | _PAGE_PRESENT)); pud =pud_offset (pgd,0 );BUG_ON (pmd_table !=pmd_offset (pud,0 ));
@@ -97,7 +97,7 @@ (pte_t *)alloc_bootmem_low_pages (PAGE_SIZE ); } -paravirt_alloc_pt (&init_mm,__pa (page_table) >>PAGE_SHIFT ); +paravirt_alloc_pte (&init_mm,__pa (page_table) >>PAGE_SHIFT );set_pmd (pmd,__pmd (__pa (page_table) | _PAGE_TABLE));BUG_ON (page_table !=pte_offset_kernel (pmd,0 )); }
@@ -374,7 +374,7 @@pte_clear (NULL , va, pte); } -paravirt_alloc_pd (&init_mm,__pa (base) >>PAGE_SHIFT ); +paravirt_alloc_pmd (&init_mm,__pa (base) >>PAGE_SHIFT ); }void __init native_pagetable_setup_done (pgd_t *base)
arch/x86/mm/ioremap.c +1 -1
@@ -332,7 +332,7 @@ pmd =early_ioremap_pmd (fix_to_virt (FIX_BTMAP_BEGIN ));pmd_clear (pmd); -paravirt_release_pt (__pa (bm_pte) >>PAGE_SHIFT ); +paravirt_release_pte (__pa (bm_pte) >>PAGE_SHIFT );__flush_tlb_all (); }
arch/x86/mm/pageattr.c +1 -1
@@ -249,7 +249,7 @@ address =__pa (address); addr = address &LARGE_PAGE_MASK ; pbase = (pte_t *)page_address (base); -paravirt_alloc_pt (&init_mm,page_to_pfn (base)); +paravirt_alloc_pte (&init_mm,page_to_pfn (base));pgprot_val (ref_prot) &= ~_PAGE_NX;for (i =0 ; i <PTRS_PER_PTE ; i++, addr +=PAGE_SIZE )
arch/x86/mm/pgtable.c +8 -8
@@ -20,14 +20,14 @@void __pte_free_tlb (struct mmu_gather *tlb,struct page *pte) { -paravirt_release_pt (page_to_pfn (pte)); +paravirt_release_pte (page_to_pfn (pte));tlb_remove_page (tlb, pte); }#if PAGETABLE_LEVELS >2 void __pmd_free_tlb (struct mmu_gather *tlb,pmd_t *pmd) { -paravirt_release_pd (__pa (pmd) >>PAGE_SHIFT ); +paravirt_release_pmd (__pa (pmd) >>PAGE_SHIFT );tlb_remove_page (tlb,virt_to_page (pmd)); }
@@ -117,10 +117,10 @@clone_pgd_range (pgd +USER_PTRS_PER_PGD , swapper_pg_dir +USER_PTRS_PER_PGD ,KERNEL_PGD_PTRS ); -paravirt_alloc_pd_clone (__pa (pgd) >>PAGE_SHIFT , -__pa (swapper_pg_dir) >>PAGE_SHIFT , -USER_PTRS_PER_PGD , -KERNEL_PGD_PTRS ); +paravirt_alloc_pmd_clone (__pa (pgd) >>PAGE_SHIFT , +__pa (swapper_pg_dir) >>PAGE_SHIFT , +USER_PTRS_PER_PGD , +KERNEL_PGD_PTRS ); }/* list required to sync kernel mapping updates */
@@ -161,7 +161,7 @@ pgdp[i] =native_make_pgd (0 ); -paravirt_release_pd (pgd_val (pgd) >>PAGE_SHIFT ); +paravirt_release_pmd (pgd_val (pgd) >>PAGE_SHIFT );pmd_free (pmd); } }
@@ -219,7 +219,7 @@ {pgd_t *pgd =quicklist_alloc (0 ,GFP_KERNEL , pgd_ctor); - mm->pgd = pgd;/* so that alloc_pd can use it */ + mm->pgd = pgd;/* so that alloc_pmd can use it */ if (pgd && !pgd_prepopulate_pmd (mm, pgd)) {quicklist_free (0 , pgd_dtor, pgd);
arch/x86/xen/enlighten.c +15 -15
@@ -652,15 +652,15 @@/* Early in boot, while setting up the initial pagetable, assume everything is pinned. */ -static __init void xen_alloc_pt_init (struct mm_struct *mm,u32 pfn) +static __init void xen_alloc_pte_init (struct mm_struct *mm,u32 pfn) {BUG_ON (mem_map);/* should only be used early */ make_lowmem_page_readonly (__va (PFN_PHYS (pfn))); } -/* Early release_pt assumes that all pts are pinned, since there's +/* Early release_pte assumes that all pts are pinned, since there's only init_mm and anything attached to that is pinned. */ -static void xen_release_pt_init (u32 pfn) +static void xen_release_pte_init (u32 pfn) {make_lowmem_page_readwrite (__va (PFN_PHYS (pfn))); }
@@ -693,18 +693,18 @@ } } -static void xen_alloc_pt (struct mm_struct *mm,u32 pfn) +static void xen_alloc_pte (struct mm_struct *mm,u32 pfn) {xen_alloc_ptpage (mm, pfn,MMUEXT_PIN_L1_TABLE ); } -static void xen_alloc_pd (struct mm_struct *mm,u32 pfn) +static void xen_alloc_pmd (struct mm_struct *mm,u32 pfn) {xen_alloc_ptpage (mm, pfn,MMUEXT_PIN_L2_TABLE ); }/* This should never happen until we're OK to use struct page */ -static void xen_release_pt (u32 pfn) +static void xen_release_pte (u32 pfn) {struct page *page =pfn_to_page (pfn);
@@ -804,10 +804,10 @@ {/* This will work as long as patching hasn't happened yet (which it hasn't) */ - pv_mmu_ops.alloc_pt = xen_alloc_pt; - pv_mmu_ops.alloc_pd = xen_alloc_pd; - pv_mmu_ops.release_pt = xen_release_pt; - pv_mmu_ops.release_pd = xen_release_pt; + pv_mmu_ops.alloc_pte = xen_alloc_pte; + pv_mmu_ops.alloc_pmd = xen_alloc_pmd; + pv_mmu_ops.release_pte = xen_release_pte; + pv_mmu_ops.release_pmd = xen_release_pte; pv_mmu_ops.set_pte = xen_set_pte;if (!xen_feature (XENFEAT_auto_translated_physmap)) {
@@ -1030,11 +1030,11 @@ .pte_update = paravirt_nop, .pte_update_defer = paravirt_nop, - .alloc_pt = xen_alloc_pt_init, - .release_pt = xen_release_pt_init, - .alloc_pd = xen_alloc_pt_init, - .alloc_pd_clone = paravirt_nop, - .release_pd = xen_release_pt_init, + .alloc_pte = xen_alloc_pte_init, + .release_pte = xen_release_pte_init, + .alloc_pmd = xen_alloc_pte_init, + .alloc_pmd_clone = paravirt_nop, + .release_pmd = xen_release_pte_init, #ifdef CONFIG_HIGHPTE .kmap_atomic_pte = xen_kmap_atomic_pte,
include/asm-x86/paravirt.h +16 -16
@@ -220,11 +220,11 @@ unsigned long va);/* Hooks for allocating/releasing pagetable pages */ -void (*alloc_pt)(struct mm_struct *mm,u32 pfn); -void (*alloc_pd)(struct mm_struct *mm,u32 pfn); -void (*alloc_pd_clone)(u32 pfn,u32 clonepfn,u32 start,u32 count); -void (*release_pt)(u32 pfn); -void (*release_pd)(u32 pfn); +void (*alloc_pte)(struct mm_struct *mm,u32 pfn); +void (*alloc_pmd)(struct mm_struct *mm,u32 pfn); +void (*alloc_pmd_clone)(u32 pfn,u32 clonepfn,u32 start,u32 count); +void (*release_pte)(u32 pfn); +void (*release_pmd)(u32 pfn);/* Pagetable manipulation functions */ void (*set_pte)(pte_t *ptep,pte_t pteval);
@@ -894,28 +894,28 @@PVOP_VCALL3 (pv_mmu_ops.flush_tlb_others, &cpumask, mm, va); } -static inline void paravirt_alloc_pt (struct mm_struct *mm,unsigned pfn) +static inline void paravirt_alloc_pte (struct mm_struct *mm,unsigned pfn) { -PVOP_VCALL2 (pv_mmu_ops.alloc_pt, mm, pfn); +PVOP_VCALL2 (pv_mmu_ops.alloc_pte, mm, pfn); } -static inline void paravirt_release_pt (unsigned pfn) +static inline void paravirt_release_pte (unsigned pfn) { -PVOP_VCALL1 (pv_mmu_ops.release_pt, pfn); +PVOP_VCALL1 (pv_mmu_ops.release_pte, pfn); } -static inline void paravirt_alloc_pd (struct mm_struct *mm,unsigned pfn) +static inline void paravirt_alloc_pmd (struct mm_struct *mm,unsigned pfn) { -PVOP_VCALL2 (pv_mmu_ops.alloc_pd, mm, pfn); +PVOP_VCALL2 (pv_mmu_ops.alloc_pmd, mm, pfn); } -static inline void paravirt_alloc_pd_clone (unsigned pfn,unsigned clonepfn, -unsigned start,unsigned count) +static inline void paravirt_alloc_pmd_clone (unsigned pfn,unsigned clonepfn, +unsigned start,unsigned count) { -PVOP_VCALL4 (pv_mmu_ops.alloc_pd_clone, pfn, clonepfn, start, count); +PVOP_VCALL4 (pv_mmu_ops.alloc_pmd_clone, pfn, clonepfn, start, count); } -static inline void paravirt_release_pd (unsigned pfn) +static inline void paravirt_release_pmd (unsigned pfn) { -PVOP_VCALL1 (pv_mmu_ops.release_pd, pfn); +PVOP_VCALL1 (pv_mmu_ops.release_pmd, pfn); }#ifdef CONFIG_HIGHPTE
include/asm-x86/pgalloc.h +8 -8
@@ -8,11 +8,11 @@#ifdef CONFIG_PARAVIRT #include <asm/paravirt.h> #else -#define paravirt_alloc_pt (mm, pfn) do { } while (0) -#define paravirt_alloc_pd (mm, pfn) do { } while (0) -#define paravirt_alloc_pd_clone (pfn, clonepfn, start, count) do { } while (0) -#define paravirt_release_pt (pfn) do { } while (0) -#define paravirt_release_pd (pfn) do { } while (0) +#define paravirt_alloc_pte (mm, pfn) do { } while (0) +#define paravirt_alloc_pmd (mm, pfn) do { } while (0) +#define paravirt_alloc_pmd_clone (pfn, clonepfn, start, count) do { } while (0) +#define paravirt_release_pte (pfn) do { } while (0) +#define paravirt_release_pmd (pfn) do { } while (0)#endif /*
@@ -43,7 +43,7 @@static inline void pmd_populate_kernel (struct mm_struct *mm,pmd_t *pmd,pte_t *pte) { -paravirt_alloc_pt (mm,__pa (pte) >>PAGE_SHIFT ); +paravirt_alloc_pte (mm,__pa (pte) >>PAGE_SHIFT );set_pmd (pmd,__pmd (__pa (pte) | _PAGE_TABLE)); }
@@ -52,7 +52,7 @@ {unsigned long pfn =page_to_pfn (pte); -paravirt_alloc_pt (mm, pfn); +paravirt_alloc_pte (mm, pfn);set_pmd (pmd,__pmd (((pteval_t )pfn <<PAGE_SHIFT ) | _PAGE_TABLE)); }
@@ -72,7 +72,7 @@static inline void pud_populate (struct mm_struct *mm,pud_t *pudp,pmd_t *pmd) { -paravirt_alloc_pd (mm,__pa (pmd) >>PAGE_SHIFT ); +paravirt_alloc_pmd (mm,__pa (pmd) >>PAGE_SHIFT );/* Note: almost everything apart from _PAGE_PRESENT is reserved at the pmd (PDPT) level. */
Re: [PATCH 3 of 5] x86/pgtable.h: demacro ptep_set_access_flags
In reply to Jeremy Fitzhardingei've applied this series too. It's pretty straightforward changes, mostly at the right granularity level.
a few style nits though (i fixed them up, so no need to resend):
include/asm-x86/pgtable.h line 306
Quoted 7 lines
include/asm-x86/pgtable.h +7
-0+static inline int ptep_set_access_flags (struct vm_area_struct *vma, +unsigned long address,pte_t *ptep, +pte_t entry,int dirty) +{ +int changed = !pte_same (*ptep, entry); +if (changed && dirty) { + *ptep = entry;
we put a newline between variable definitions and the first code statement. That makes it a tiny bit easier to see the structure of the code.
Ingo
Re: [PATCH 3 of 5] x86/pgtable.h: demacro ptep_set_access_flags
In reply to Jeremy Fitzhardingeinclude/asm-x86/pgtable.h line 311
Quoted 12 lines · Jeremy Fitzhardinge
include/asm-x86/pgtable.h +12
-0+static inline int ptep_set_access_flags (struct vm_area_struct *vma, +unsigned long address,pte_t *ptep, +pte_t entry,int dirty) +{ +int changed = !pte_same (*ptep, entry); +if (changed && dirty) { + *ptep = entry; +pte_update_defer (vma->vm_mm, address, ptep); +flush_tlb_page (vma, address); + } +return changed; +}
another thing: these inlines are a bit fat and they are used in more than one place. Please move them into pgtable.c. The rule of thumb is:
if an inline is more than 2 lines big, it is a likely candidate for uninlining. (and even many 2-liners, and even some 1-liners are candidates) Especially under paravirt the MMU inlines grow these update notifiers so they become even fatter.
having functions instead of inlines also simplifies the type dependencies by quite a degree.
Ingo
Re: [PATCH 3 of 5] x86/pgtable.h: demacro ptep_set_access_flags
Quoted 2 lines · Ingo Molnar
another thing: these inlines are a bit fat and they are used in more than one place. Please move them into
pgtable.c. The rule of thumb is: if an inline is more than 2 lines big, it is a likely candidate for uninlining. (and even many 2-liners, and even some 1-liners are candidates) Especially under paravirt the MMU inlines grow these update notifiers so they become even fatter.
I agree, but I wanted to keep it semantically equivalent to the original. I'll add a move to out of line patch.
Quoted 2 lines
having functions instead of inlines also simplifies the type dependencies by quite a degree.
Indeed, the floating asm/tlbflush.h is a bit of a wart.
J