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


Groups > linux.kernel > #1332038 > unrolled thread

[PATCHv2 15/28] thp: handle file COW faults

Started by"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
First post2016-02-11 15:30 +0100
Last post2016-02-16 11:10 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCHv2 15/28] thp: handle file COW faults "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-02-11 15:30 +0100
    Re: [PATCHv2 15/28] thp: handle file COW faults Dave Hansen <dave.hansen@intel.com> - 2016-02-12 19:40 +0100
      Re: [PATCHv2 15/28] thp: handle file COW faults "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-02-16 11:10 +0100

#1332038 — [PATCHv2 15/28] thp: handle file COW faults

From"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Date2016-02-11 15:30 +0100
Subject[PATCHv2 15/28] thp: handle file COW faults
Message-ID<r10pQ-1zg-9@gated-at.bofh.it>
File COW for THP is handled on pte level: just split the pmd.

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 6c98ed8e3c4a..19eff2164e5b 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3334,6 +3334,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

[toc] | [next] | [standalone]


#1333022

FromDave Hansen <dave.hansen@intel.com>
Date2016-02-12 19:40 +0100
Message-ID<r1qNm-2ew-57@gated-at.bofh.it>
In reply to#1332038
On 02/11/2016 06:21 AM, Kirill A. Shutemov wrote:
> File COW for THP is handled on pte level: just split the pmd.

More changelog.  More comments, please.

We don't want to COW THP's because we'll waste memory?  A COW that we
could handle with 4k, we would have to handle with 2M, and that's
inefficient and high-latency?

Seems like a good idea to me.  It would just be nice to ensure every
reviewer doesn't have to think their way through it.

[toc] | [prev] | [next] | [standalone]


#1335238

From"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Date2016-02-16 11:10 +0100
Message-ID<r2KJY-6rY-39@gated-at.bofh.it>
In reply to#1333022
On Fri, Feb 12, 2016 at 10:36:25AM -0800, Dave Hansen wrote:
> On 02/11/2016 06:21 AM, Kirill A. Shutemov wrote:
> > File COW for THP is handled on pte level: just split the pmd.
> 
> More changelog.  More comments, please.

Okay, I'll add more.

> We don't want to COW THP's because we'll waste memory?  A COW that we
> could handle with 4k, we would have to handle with 2M, and that's
> inefficient and high-latency?

All of above.i

It's not clear how benefitial THP file COW mappings. And it would require
some code to make them work.

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

> Seems like a good idea to me.  It would just be nice to ensure every
> reviewer doesn't have to think their way through it.

-- 
 Kirill A. Shutemov

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web