Thread (8 messages) flat view 8 messages, 3 authors, 2015-05-11

Re: [PATCH V2 1/2] mm/thp: Split out pmd collpase flush into a seperate functions

From: Aneesh Kumar K.V <hidden>
Date: 2015-05-11 06:34:00
Also in: linux-mm, lkml

Andrew Morton [off-list ref] writes:
On Thu,  7 May 2015 12:53:27 +0530 "Aneesh Kumar K.V" [off-list ref] wrote:
quoted
After this patch pmdp_* functions operate only on hugepage pte,
and not on regular pmd_t values pointing to page table.
The patch looks like a pretty safe no-op for non-powerpc?
That is correct. I also updated the commit message

    mm/thp: Split out pmd collpase flush into a seperate functions
    
    Architectures like ppc64 [1] need to do special things while clearing
    pmd before a collapse. For them this operation is largely different
    from a normal hugepage pte clear. Hence add a separate function
    to clear pmd before collapse. After this patch pmdp_* functions
    operate only on hugepage pte, and not on regular pmd_t values
    pointing to page table.
    
    [1] ppc64 needs to invalidate all the normal page pte mappings we
    already have inserted in the hardware hash page table. But before
    doing that we need to make sure there are no parallel hash page
    table insert going on. So we need to do a kick_all_cpus_sync()
    before flushing the older hash table entries. By moving this to
    a separate function we capture these details and mention how it
    is different from a hugepage pte clear.

quoted
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -576,6 +576,10 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm, unsigned long addr,
 extern void pmdp_splitting_flush(struct vm_area_struct *vma,
 				 unsigned long address, pmd_t *pmdp);
 
+#define __HAVE_ARCH_PMDP_COLLAPSE_FLUSH
+extern pmd_t pmdp_collapse_flush(struct vm_area_struct *vma,
+				 unsigned long address, pmd_t *pmdp);
+
The fashionable way of doing this is

extern pmd_t pmdp_collapse_flush(struct vm_area_struct *vma,
				 unsigned long address, pmd_t *pmdp);
#define pmdp_collapse_flush pmdp_collapse_flush

then, elsewhere,

#ifndef pmdp_collapse_flush
static inline pmd_t pmdp_collapse_flush(...) {}
#define pmdp_collapse_flush pmdp_collapse_flush
#endif

It avoids introducing a second (ugly) symbol into the kernel.
Ok updated to the above style. The reason I used the earlier style was
because of similar usages in asm-generic/pgtable.h


-aneesh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help