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


Groups > linux.kernel > #1349402

[PATCHv3 14/29] thp: handle file COW faults

From "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCHv3 14/29] thp: handle file COW faults
Date 2016-03-03 18:10 +0100
Message-ID <r8EVe-1Ta-37@gated-at.bofh.it> (permalink)
References <r8ELv-1ze-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


File COW for THP is handled on pte level: just split the pmd.

It's not clear how benefitial would be allocation of huge pages on COW
faults. And it would require some code to make them work.

I think at some point we can consider teaching khugepaged to collapse
pages in COW mappings, but allocating huge on fault is probably
overkill.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
 mm/memory.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mm/memory.c b/mm/memory.c
index ab9acc4d83a2..0acdd33bfe16 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3369,6 +3369,11 @@ static int wp_huge_pmd(struct fault_env *fe, pmd_t orig_pmd)
 	if (fe->vma->vm_ops->pmd_fault)
 		return fe->vma->vm_ops->pmd_fault(fe->vma, fe->address, fe->pmd,
 				fe->flags);
+
+	/* COW handled on pte level: split pmd */
+	VM_BUG_ON_VMA(fe->vma->vm_flags & VM_SHARED, fe->vma);
+	split_huge_pmd(fe->vma, fe->pmd, fe->address);
+
 	return VM_FAULT_FALLBACK;
 }
 
-- 
2.7.0

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


Thread

[PATCHv3 00/29] huge tmpfs implementation using compound pages "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 25/29] truncate: handle file thp "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 05/29] mm: do not pass mm_struct into handle_mm_fault "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 12/29] thp: support file pages in zap_huge_pmd() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 18/29] thp: run vma_adjust_trans_huge() outside i_mmap_rwsem "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 29/29] shmem, thp: respect MADV_{NO,}HUGEPAGE for file mappings "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 03/29] mm: make remove_migration_ptes() beyond mm/migration.c "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 14/29] thp: handle file COW faults "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 02/29] rmap: extend try_to_unmap() to be usable by split_huge_page() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 01/29] rmap: introduce rmap_walk_locked() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 07/29] mm: postpone page table allocation until we have page to map "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 13/29] thp: handle file pages in split_huge_pmd() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 15/29] thp: handle file pages in mremap() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 20/29] thp, mlock: do not mlock PTE-mapped file huge pages "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 08/29] rmap: support file thp "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 16/29] thp: skip file huge pmd on copy_huge_pmd() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  [PATCHv3 22/29] page-flags: relax policy for PG_mappedtodisk and PG_reclaim "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-03-03 18:10 +0100
  Re: [PATCHv3 00/29] huge tmpfs implementation using compound pages Sasha Levin <sasha.levin@oracle.com> - 2016-03-04 05:30 +0100

csiph-web