History

mm: split huge PUD on wp_huge_pud fallback

Currently the implementation will split the PUD when a fallback is taken inside the create_huge_pud function. This isn't where it should be done: the splitting should be done in wp_huge_pud, just like it's done for PMDs. Reason being that if a callback is taken during create, there is no PUD yet so nothing to split, whereas if a fallback is taken when encountering a write protection fault there is something to split. It looks like this was the original intention with the commit where the splitting was introduced, but somehow it got moved to the wrong place between v1 and v2 of the patch series. Rebase mistake perhaps.

Gowans, James committed 4 years ago

Commit 14c99d61 parent 5924e6e1 file · +14 −13Browse files

Unified · Split

mm/memory.c+14−13
@@ -4798,6 +4798,19 @@ static inline vm_fault_t wp_huge_pmd(struct vm_fault *vmf) · 4797 unmodified lines
4798 4798
4799static vm_fault_t create_huge_pud(struct vm_fault *vmf)4799static vm_fault_t create_huge_pud(struct vm_fault *vmf)
4800{4800{
4801#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && \
4802 defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)
4803 /* No support for anonymous transparent PUD pages yet */
4804 if (vma_is_anonymous(vmf->vma))
4805 return VM_FAULT_FALLBACK;
4806 if (vmf->vma->vm_ops->huge_fault)
4807 return vmf->vma->vm_ops->huge_fault(vmf, PE_SIZE_PUD);
4808#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
4809 return VM_FAULT_FALLBACK;
4810}
4811
4812static vm_fault_t wp_huge_pud(struct vm_fault *vmf, pud_t orig_pud)
4813{
4801#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && \4814#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && \
4802 defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)4815 defined(CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)
4803 /* No support for anonymous transparent PUD pages yet */4816 /* No support for anonymous transparent PUD pages yet */
@@ -4812,19 +4825,7 @@ static vm_fault_t create_huge_pud(struct vm_fault *vmf) · 8 unmodified lines
4812split:4825split:
4813 /* COW or write-notify not handled on PUD level: split pud.*/4826 /* COW or write-notify not handled on PUD level: split pud.*/
4814 __split_huge_pud(vmf->vma, vmf->pud, vmf->address);4827 __split_huge_pud(vmf->vma, vmf->pud, vmf->address);
4815#endif /* CONFIG_TRANSPARENT_HUGEPAGE */4828#endif /* CONFIG_TRANSPARENT_HUGEPAGE && CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */
4816 return VM_FAULT_FALLBACK;
4817}
4818
4819static vm_fault_t wp_huge_pud(struct vm_fault *vmf, pud_t orig_pud)
4820{
4821#ifdef CONFIG_TRANSPARENT_HUGEPAGE
4822 /* No support for anonymous transparent PUD pages yet */
4823 if (vma_is_anonymous(vmf->vma))
4824 return VM_FAULT_FALLBACK;
4825 if (vmf->vma->vm_ops->huge_fault)
4826 return vmf->vma->vm_ops->huge_fault(vmf, PE_SIZE_PUD);
4827#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
4828 return VM_FAULT_FALLBACK;4829 return VM_FAULT_FALLBACK;
4829}4830}
4830 4831

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t