aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2015-02-12 17:58:32 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-12 21:54:08 -0500
commit21d9ee3eda7792c45880b2f11bff8e95c9a061fb (patch)
tree2e20932b8f1526e6d1f48add9e818ed43d7be8ee /include/asm-generic
parent4d9424669946532be754a6e116618dcb58430cb4 (diff)
mm: remove remaining references to NUMA hinting bits and helpers
This patch removes the NUMA PTE bits and associated helpers. As a side-effect it increases the maximum possible swap space on x86-64. One potential source of problems is races between the marking of PTEs PROT_NONE, NUMA hinting faults and migration. It must be guaranteed that a PTE being protected is not faulted in parallel, seen as a pte_none and corrupting memory. The base case is safe but transhuge has problems in the past due to an different migration mechanism and a dependance on page lock to serialise migrations and warrants a closer look. task_work hinting update parallel fault ------------------------ -------------- change_pmd_range change_huge_pmd __pmd_trans_huge_lock pmdp_get_and_clear __handle_mm_fault pmd_none do_huge_pmd_anonymous_page read? pmd_lock blocks until hinting complete, fail !pmd_none test write? __do_huge_pmd_anonymous_page acquires pmd_lock, checks pmd_none pmd_modify set_pmd_at task_work hinting update parallel migration ------------------------ ------------------ change_pmd_range change_huge_pmd __pmd_trans_huge_lock pmdp_get_and_clear __handle_mm_fault do_huge_pmd_numa_page migrate_misplaced_transhuge_page pmd_lock waits for updates to complete, recheck pmd_same pmd_modify set_pmd_at Both of those are safe and the case where a transhuge page is inserted during a protection update is unchanged. The case where two processes try migrating at the same time is unchanged by this series so should still be ok. I could not find a case where we are accidentally depending on the PTE not being cleared and flushed. If one is missed, it'll manifest as corruption problems that start triggering shortly after this series is merged and only happen when NUMA balancing is enabled. Signed-off-by: Mel Gorman <mgorman@suse.de> Tested-by: Sasha Levin <sasha.levin@oracle.com> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Dave Jones <davej@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Rik van Riel <riel@redhat.com> Cc: Mark Brown <broonie@kernel.org> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/pgtable.h155
1 files changed, 0 insertions, 155 deletions
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 067922c06c29..4d46085c1b90 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -244,10 +244,6 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
244# define pte_accessible(mm, pte) ((void)(pte), 1) 244# define pte_accessible(mm, pte) ((void)(pte), 1)
245#endif 245#endif
246 246
247#ifndef pte_present_nonuma
248#define pte_present_nonuma(pte) pte_present(pte)
249#endif
250
251#ifndef flush_tlb_fix_spurious_fault 247#ifndef flush_tlb_fix_spurious_fault
252#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address) 248#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address)
253#endif 249#endif
@@ -693,157 +689,6 @@ static inline int pmd_protnone(pmd_t pmd)
693} 689}
694#endif /* CONFIG_NUMA_BALANCING */ 690#endif /* CONFIG_NUMA_BALANCING */
695 691
696#ifdef CONFIG_NUMA_BALANCING
697/*
698 * _PAGE_NUMA distinguishes between an unmapped page table entry, an entry that
699 * is protected for PROT_NONE and a NUMA hinting fault entry. If the
700 * architecture defines __PAGE_PROTNONE then it should take that into account
701 * but those that do not can rely on the fact that the NUMA hinting scanner
702 * skips inaccessible VMAs.
703 *
704 * pte/pmd_present() returns true if pte/pmd_numa returns true. Page
705 * fault triggers on those regions if pte/pmd_numa returns true
706 * (because _PAGE_PRESENT is not set).
707 */
708#ifndef pte_numa
709static inline int pte_numa(pte_t pte)
710{
711 return ptenuma_flags(pte) == _PAGE_NUMA;
712}
713#endif
714
715#ifndef pmd_numa
716static inline int pmd_numa(pmd_t pmd)
717{
718 return pmdnuma_flags(pmd) == _PAGE_NUMA;
719}
720#endif
721
722/*
723 * pte/pmd_mknuma sets the _PAGE_ACCESSED bitflag automatically
724 * because they're called by the NUMA hinting minor page fault. If we
725 * wouldn't set the _PAGE_ACCESSED bitflag here, the TLB miss handler
726 * would be forced to set it later while filling the TLB after we
727 * return to userland. That would trigger a second write to memory
728 * that we optimize away by setting _PAGE_ACCESSED here.
729 */
730#ifndef pte_mknonnuma
731static inline pte_t pte_mknonnuma(pte_t pte)
732{
733 pteval_t val = pte_val(pte);
734
735 val &= ~_PAGE_NUMA;
736 val |= (_PAGE_PRESENT|_PAGE_ACCESSED);
737 return __pte(val);
738}
739#endif
740
741#ifndef pmd_mknonnuma
742static inline pmd_t pmd_mknonnuma(pmd_t pmd)
743{
744 pmdval_t val = pmd_val(pmd);
745
746 val &= ~_PAGE_NUMA;
747 val |= (_PAGE_PRESENT|_PAGE_ACCESSED);
748
749 return __pmd(val);
750}
751#endif
752
753#ifndef pte_mknuma
754static inline pte_t pte_mknuma(pte_t pte)
755{
756 pteval_t val = pte_val(pte);
757
758 VM_BUG_ON(!(val & _PAGE_PRESENT));
759
760 val &= ~_PAGE_PRESENT;
761 val |= _PAGE_NUMA;
762
763 return __pte(val);
764}
765#endif
766
767#ifndef ptep_set_numa
768static inline void ptep_set_numa(struct mm_struct *mm, unsigned long addr,
769 pte_t *ptep)
770{
771 pte_t ptent = *ptep;
772
773 ptent = pte_mknuma(ptent);
774 set_pte_at(mm, addr, ptep, ptent);
775 return;
776}
777#endif
778
779#ifndef pmd_mknuma
780static inline pmd_t pmd_mknuma(pmd_t pmd)
781{
782 pmdval_t val = pmd_val(pmd);
783
784 val &= ~_PAGE_PRESENT;
785 val |= _PAGE_NUMA;
786
787 return __pmd(val);
788}
789#endif
790
791#ifndef pmdp_set_numa
792static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr,
793 pmd_t *pmdp)
794{
795 pmd_t pmd = *pmdp;
796
797 pmd = pmd_mknuma(pmd);
798 set_pmd_at(mm, addr, pmdp, pmd);
799 return;
800}
801#endif
802#else
803static inline int pmd_numa(pmd_t pmd)
804{
805 return 0;
806}
807
808static inline int pte_numa(pte_t pte)
809{
810 return 0;
811}
812
813static inline pte_t pte_mknonnuma(pte_t pte)
814{
815 return pte;
816}
817
818static inline pmd_t pmd_mknonnuma(pmd_t pmd)
819{
820 return pmd;
821}
822
823static inline pte_t pte_mknuma(pte_t pte)
824{
825 return pte;
826}
827
828static inline void ptep_set_numa(struct mm_struct *mm, unsigned long addr,
829 pte_t *ptep)
830{
831 return;
832}
833
834
835static inline pmd_t pmd_mknuma(pmd_t pmd)
836{
837 return pmd;
838}
839
840static inline void pmdp_set_numa(struct mm_struct *mm, unsigned long addr,
841 pmd_t *pmdp)
842{
843 return ;
844}
845#endif /* CONFIG_NUMA_BALANCING */
846
847#endif /* CONFIG_MMU */ 692#endif /* CONFIG_MMU */
848 693
849#endif /* !__ASSEMBLY__ */ 694#endif /* !__ASSEMBLY__ */