Skip to contentSkip to conversation

+ mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Oct 7, 2013

Subsystems (8)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: + mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Mon, 07 Oct 2013 16:10:18 -0700

The patch titled
Subject: mm, hugetlb: convert hugetlbfs to use split pmd lock
has been added to the -mm tree. Its filename is
mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: "Kirill A. Shutemov" <[email protected]>
Subject: mm, hugetlb: convert hugetlbfs to use split pmd lock

Hugetlb supports multiple page sizes. We use split lock only for PMD level, but not for PUD.

Cc Ingo Molnar <[email protected]>
Cc "Eric W . Biederman" <[email protected]>
Cc "Paul E . McKenney" <[email protected]>
Cc Al Viro <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Dave Jones <[email protected]>
Cc David Howells <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Kees Cook <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Michael Kerrisk <[email protected]>
Cc Oleg Nesterov <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Robin Holt <[email protected]>
Cc Sedat Dilek <[email protected]>
Cc Srikar Dronamraju <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Hugh Dickins <[email protected]>

---

 fs/proc/meminfo.c       |    2 
 include/linux/hugetlb.h |   25 ++++++++
 include/linux/swapops.h |    7 +-
 mm/hugetlb.c            |  108 ++++++++++++++++++++++----------------
 mm/mempolicy.c          |    5 +
 mm/migrate.c            |    7 +-
 mm/rmap.c               |    2 
 7 files changed, 103 insertions(+), 53 deletions(-)
fs/proc/meminfo.c renamed from fs/proc/meminfo.c~mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock +1 -1
diff -puN fs/proc/meminfo.c~mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock fs/proc/meminfo.c
@@ -1,8 +1,8 @@
 #include <linux/fs.h>
-#include <linux/hugetlb.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/hugetlb.h>
 #include <linux/mman.h>
 #include <linux/mmzone.h>
 #include <linux/proc_fs.h>
include/linux/hugetlb.h renamed from include/linux/hugetlb.h~mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock +25 -0
diff -puN include/linux/hugetlb.h~mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock include/linux/hugetlb.h
@@ -392,6 +392,15 @@ static inline int hugepage_migration_sup
 	return pmd_huge_support() && (huge_page_shift(h) == PMD_SHIFT);
 }
 
+static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
+               struct mm_struct *mm, pte_t *pte)
+{
+       if (huge_page_size(h) == PMD_SIZE)
+               return pmd_lockptr(mm, (pmd_t *) pte);
+       VM_BUG_ON(huge_page_size(h) == PAGE_SIZE);
+       return &mm->page_table_lock;
+}
+
 #else	/* CONFIG_HUGETLB_PAGE */
 struct hstate {};
 #define alloc_huge_page_node(h, nid) NULL
@@ -401,6 +410,7 @@ struct hstate {};
 #define hstate_sizelog(s) NULL
 #define hstate_vma(v) NULL
 #define hstate_inode(i) NULL
+#define page_hstate(page) NULL
 #define huge_page_size(h) PAGE_SIZE
 #define huge_page_mask(h) PAGE_MASK
 #define vma_kernel_pagesize(v) PAGE_SIZE
@@ -421,6 +431,21 @@ static inline pgoff_t basepage_index(str
 #define dissolve_free_huge_pages(s, e)	do {} while (0)
 #define pmd_huge_support()	0
 #define hugepage_migration_support(h)	0
+
+static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
+               struct mm_struct *mm, pte_t *pte)
+{
+       return &mm->page_table_lock;
+}
 #endif	/* CONFIG_HUGETLB_PAGE */
 
+static inline spinlock_t *huge_pte_lock(struct hstate *h,
+               struct mm_struct *mm, pte_t *pte)
+{
+       spinlock_t *ptl;
+       ptl = huge_pte_lockptr(h, mm, pte);
+       spin_lock(ptl);
+       return ptl;
+}
+
 #endif /* _LINUX_HUGETLB_H */
include/linux/swapops.h renamed from include/linux/swapops.h~mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock +4 -3
diff -puN include/linux/swapops.h~mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock include/linux/swapops.h
@@ -139,7 +139,8 @@ static inline void make_migration_entry_
 
 extern void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
 					unsigned long address);
-extern void migration_entry_wait_huge(struct mm_struct *mm, pte_t *pte);
+extern void migration_entry_wait_huge(struct vm_area_struct *vma,
+		struct mm_struct *mm, pte_t *pte);
 #else
 
 #define make_migration_entry(page, write) swp_entry(0, 0)
@@ -151,8 +152,8 @@ static inline int is_migration_entry(swp
 static inline void make_migration_entry_read(swp_entry_t *entryp) { }
 static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
 					 unsigned long address) { }
-static inline void migration_entry_wait_huge(struct mm_struct *mm,
-					pte_t *pte) { }
+static inline void migration_entry_wait_huge(struct vm_area_struct *vma,
+		struct mm_struct *mm, pte_t *pte) { }
 static inline int is_write_migration_entry(swp_entry_t entry)
 {
 	return 0;
mm/hugetlb.c renamed from mm/hugetlb.c~mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock +65 -43

357 lines not on this page · raw message

mm/mempolicy.c renamed from mm/mempolicy.c~mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock +3 -2
diff -puN mm/mempolicy.c~mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock mm/mempolicy.c
@@ -525,8 +525,9 @@ static void queue_pages_hugetlb_pmd_rang
 #ifdef CONFIG_HUGETLB_PAGE
 	int nid;
 	struct page *page;
+	spinlock_t *ptl;
 
-	spin_lock(&vma->vm_mm->page_table_lock);
+	ptl = huge_pte_lock(hstate_vma(vma), vma->vm_mm, (pte_t *)pmd);
 	page = pte_page(huge_ptep_get((pte_t *)pmd));
 	nid = page_to_nid(page);
 	if (node_isset(nid, *nodes) == !!(flags & MPOL_MF_INVERT))
@@ -536,7 +537,7 @@ static void queue_pages_hugetlb_pmd_rang
 	    (flags & MPOL_MF_MOVE && page_mapcount(page) == 1))
 		isolate_huge_page(page, private);
 unlock:
-	spin_unlock(&vma->vm_mm->page_table_lock);
+	spin_unlock(ptl);
 #else
 	BUG();
 #endif
mm/migrate.c renamed from mm/migrate.c~mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock +4 -3
diff -puN mm/migrate.c~mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock mm/migrate.c
@@ -130,7 +130,7 @@ static int remove_migration_pte(struct p
 		ptep = huge_pte_offset(mm, addr);
 		if (!ptep)
 			goto out;
-		ptl = &mm->page_table_lock;
+		ptl = huge_pte_lockptr(hstate_vma(vma), mm, ptep);
 	} else {
 		pmd = mm_find_pmd(mm, addr);
 		if (!pmd)
@@ -247,9 +247,10 @@ void migration_entry_wait(struct mm_stru
 	__migration_entry_wait(mm, ptep, ptl);
 }
 
-void migration_entry_wait_huge(struct mm_struct *mm, pte_t *pte)
+void migration_entry_wait_huge(struct vm_area_struct *vma,
+		struct mm_struct *mm, pte_t *pte)
 {
-	spinlock_t *ptl = &(mm)->page_table_lock;
+	spinlock_t *ptl = huge_pte_lockptr(hstate_vma(vma), mm, pte);
 	__migration_entry_wait(mm, pte, ptl);
 }
 
mm/rmap.c renamed from mm/rmap.c~mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock +1 -1
diff -puN mm/rmap.c~mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock mm/rmap.c
@@ -601,7 +601,7 @@ pte_t *__page_check_address(struct page
 
 	if (unlikely(PageHuge(page))) {
 		pte = huge_pte_offset(mm, address);
-		ptl = &mm->page_table_lock;
+		ptl = huge_pte_lockptr(page_hstate(page), mm, pte);
 		goto check;
 	}
 

_

Patches currently in -mm which might be from [email protected] are

mm-huge_memoryc-fix-stale-comments-of-transparent_hugepage_flags.patch mm-thp-cleanup-mv-alloc_hugepage-to-better-place.patch mm-thp-khugepaged-add-policy-for-finding-target-node.patch mm-thp-khugepaged-add-policy-for-finding-target-node-fix.patch mm-avoid-increase-sizeofstruct-page-due-to-split-page-table-lock.patch mm-rename-use_split_ptlocks-to-use_split_pte_ptlocks.patch mm-convert-mm-nr_ptes-to-atomic_long_t.patch mm-introduce-api-for-split-page-table-lock-for-pmd-level.patch mm-thp-change-pmd_trans_huge_lock-to-return-taken-lock.patch mm-thp-move-ptl-taking-inside-page_check_address_pmd.patch mm-thp-do-not-access-mm-pmd_huge_pte-directly.patch mm-hugetlb-convert-hugetlbfs-to-use-split-pmd-lock.patch mm-convert-the-rest-to-new-page-table-lock-api.patch mm-implement-split-page-table-lock-for-pmd-level.patch x86-mm-enable-split-page-table-lock-for-pmd-level.patch thp-mm-locking-tail-page-is-a-bug.patch mm-drop-actor-argument-of-do_generic_file_read.patch mm-drop-actor-argument-of-do_generic_file_read-fix.patch