Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1200260

[PATCH 09/11] dax: Don't use set_huge_zero_page()

From Matthew Wilcox <matthew.r.wilcox@intel.com>
Newsgroups linux.kernel
Subject [PATCH 09/11] dax: Don't use set_huge_zero_page()
Date 2015-08-04 22:00 +0200
Message-ID <pTQxs-3Do-19@gated-at.bofh.it> (permalink)
References <pTQxs-3Do-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>

This is another place where DAX assumed that pgtable_t was a pointer.
Open code the important parts of set_huge_zero_page() in DAX and make
set_huge_zero_page() static again.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
---
 fs/dax.c                | 18 ++++++++++++------
 include/linux/huge_mm.h |  3 ---
 mm/huge_memory.c        |  2 +-
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index 9daf005..bf9a22b 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -572,18 +572,24 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
 		unmap_mapping_range(mapping, pgoff << PAGE_SHIFT, PMD_SIZE, 0);
 
 	if (!write && !buffer_mapped(&bh) && buffer_uptodate(&bh)) {
-		bool set;
 		spinlock_t *ptl;
-		struct mm_struct *mm = vma->vm_mm;
+		pmd_t entry;
 		struct page *zero_page = get_huge_zero_page();
+
 		if (unlikely(!zero_page))
 			goto fallback;
 
-		ptl = pmd_lock(mm, pmd);
-		set = set_huge_zero_page(NULL, mm, vma, pmd_addr, pmd,
-								zero_page);
-		spin_unlock(ptl);
+		ptl = pmd_lock(vma->vm_mm, pmd);
+		if (!pmd_none(*pmd)) {
+			spin_unlock(ptl);
+			goto fallback;
+		}
+
+		entry = mk_pmd(zero_page, vma->vm_page_prot);
+		entry = pmd_mkhuge(entry);
+		set_pmd_at(vma->vm_mm, pmd_addr, pmd, entry);
 		result = VM_FAULT_NOPAGE;
+		spin_unlock(ptl);
 	} else {
 		sector = bh.b_blocknr << (blkbits - 9);
 		length = bdev_direct_access(bh.b_bdev, sector, &kaddr, &pfn,
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index f9b612f..ecb080d 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -163,9 +163,6 @@ static inline bool is_huge_zero_pmd(pmd_t pmd)
 }
 
 struct page *get_huge_zero_page(void);
-bool set_huge_zero_page(pgtable_t pgtable, struct mm_struct *mm,
-		struct vm_area_struct *vma, unsigned long haddr,
-		pmd_t *pmd, struct page *zero_page);
 
 #else /* CONFIG_TRANSPARENT_HUGEPAGE */
 #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index b51bed1..63c8fe5 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -767,7 +767,7 @@ static inline gfp_t alloc_hugepage_gfpmask(int defrag, gfp_t extra_gfp)
 }
 
 /* Caller must hold page table lock. */
-bool set_huge_zero_page(pgtable_t pgtable, struct mm_struct *mm,
+static bool set_huge_zero_page(pgtable_t pgtable, struct mm_struct *mm,
 		struct vm_area_struct *vma, unsigned long haddr, pmd_t *pmd,
 		struct page *zero_page)
 {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/11] DAX fixes for 4.3 Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-08-04 22:00 +0200
  [PATCH 10/11] dax: Ensure that zero pages are removed from other processes Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-08-04 22:00 +0200
  [PATCH 09/11] dax: Don't use set_huge_zero_page() Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-08-04 22:00 +0200
  [PATCH 07/11] thp: Decrement refcount on huge zero page if it is split Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-08-04 22:00 +0200
  [PATCH 08/11] thp: Fix zap_huge_pmd() for DAX Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-08-04 22:00 +0200
  [PATCH 01/11] ext4: Use ext4_get_block_write() for DAX Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-08-04 22:10 +0200
  [PATCH 06/11] dax: Fix race between simultaneous faults Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-08-04 22:10 +0200
    Re: [PATCH 06/11] dax: Fix race between simultaneous faults "Kirill A. Shutemov" <kirill@shutemov.name> - 2015-08-05 13:50 +0200
  [PATCH 11/11] dax: Use linear_page_index() Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-08-04 22:10 +0200
  [PATCH 04/11] ext4: Add ext4_get_block_dax() Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-08-04 22:10 +0200
    Re: [PATCH 04/11] ext4: Add ext4_get_block_dax() Dave Chinner <david@fromorbit.com> - 2015-08-05 04:10 +0200
      Re: [PATCH 04/11] ext4: Add ext4_get_block_dax() Matthew Wilcox <willy@linux.intel.com> - 2015-08-05 17:20 +0200
  [PATCH 05/11] ext4: Start transaction before calling into DAX Matthew Wilcox <matthew.r.wilcox@intel.com> - 2015-08-04 22:10 +0200

csiph-web