From: "Aneesh Kumar K.V" <aneesh.kumar@linux•vnet.ibm.com>
To: "Oliver O'Halloran" <oohall@gmail•com>, linuxppc-dev@lists•ozlabs.org
Cc: arbab@linux•vnet.ibm.com, bsingharora@gmail•com,
linux-nvdimm@lists•01.org, "Oliver O'Halloran" <oohall@gmail•com>,
linux-mm@kvack•org
Subject: Re: [PATCH 2/9] mm/huge_memory: Deposit a pgtable for DAX PMD faults when required
Date: Wed, 12 Apr 2017 11:21:35 +0530 [thread overview]
Message-ID: <8760iaqil4.fsf@skywalker.in.ibm.com> (raw)
In-Reply-To: <20170411174233.21902-3-oohall@gmail.com>
Oliver O'Halloran <oohall@gmail•com> writes:
> Although all architectures use a deposited page table for THP on anonymous VMAs
> some architectures (s390 and powerpc) require the deposited storage even for
> file backed VMAs due to quirks of their MMUs. This patch adds support for
> depositing a table in DAX PMD fault handling path for archs that require it.
> Other architectures should see no functional changes.
>
> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux•vnet.ibm.com>
> Cc: linux-mm@kvack•org
> Signed-off-by: Oliver O'Halloran <oohall@gmail•com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux•vnet.ibm.com>
> ---
> mm/huge_memory.c | 20 ++++++++++++++++++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index aa01dd47cc65..a84909cf20d3 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -715,7 +715,8 @@ int do_huge_pmd_anonymous_page(struct vm_fault *vmf)
> }
>
> static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,
> - pmd_t *pmd, pfn_t pfn, pgprot_t prot, bool write)
> + pmd_t *pmd, pfn_t pfn, pgprot_t prot, bool write,
> + pgtable_t pgtable)
> {
> struct mm_struct *mm = vma->vm_mm;
> pmd_t entry;
> @@ -729,6 +730,12 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,
> entry = pmd_mkyoung(pmd_mkdirty(entry));
> entry = maybe_pmd_mkwrite(entry, vma);
> }
> +
> + if (pgtable) {
> + pgtable_trans_huge_deposit(mm, pmd, pgtable);
> + atomic_long_inc(&mm->nr_ptes);
> + }
> +
> set_pmd_at(mm, addr, pmd, entry);
> update_mmu_cache_pmd(vma, addr, pmd);
> spin_unlock(ptl);
> @@ -738,6 +745,7 @@ int vmf_insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,
> pmd_t *pmd, pfn_t pfn, bool write)
> {
> pgprot_t pgprot = vma->vm_page_prot;
> + pgtable_t pgtable = NULL;
> /*
> * If we had pmd_special, we could avoid all these restrictions,
> * but we need to be consistent with PTEs and architectures that
> @@ -752,9 +760,15 @@ int vmf_insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,
> if (addr < vma->vm_start || addr >= vma->vm_end)
> return VM_FAULT_SIGBUS;
>
> + if (arch_needs_pgtable_deposit()) {
> + pgtable = pte_alloc_one(vma->vm_mm, addr);
> + if (!pgtable)
> + return VM_FAULT_OOM;
> + }
> +
> track_pfn_insert(vma, &pgprot, pfn);
>
> - insert_pfn_pmd(vma, addr, pmd, pfn, pgprot, write);
> + insert_pfn_pmd(vma, addr, pmd, pfn, pgprot, write, pgtable);
> return VM_FAULT_NOPAGE;
> }
> EXPORT_SYMBOL_GPL(vmf_insert_pfn_pmd);
> @@ -1611,6 +1625,8 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
> tlb->fullmm);
> tlb_remove_pmd_tlb_entry(tlb, pmd, addr);
> if (vma_is_dax(vma)) {
> + if (arch_needs_pgtable_deposit())
> + zap_deposited_table(tlb->mm, pmd);
> spin_unlock(ptl);
> if (is_huge_zero_pmd(orig_pmd))
> tlb_remove_page_size(tlb, pmd_page(orig_pmd), HPAGE_PMD_SIZE);
> --
> 2.9.3
next prev parent reply other threads:[~2017-04-12 5:51 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-11 17:42 ZONE_DEVICE and pmem API support for powerpc Oliver O'Halloran
2017-04-11 17:42 ` [PATCH 1/9] mm/huge_memory: Use zap_deposited_table() more Oliver O'Halloran
2017-04-12 5:44 ` Aneesh Kumar K.V
2017-04-18 21:35 ` David Rientjes
2017-04-11 17:42 ` [PATCH 2/9] mm/huge_memory: Deposit a pgtable for DAX PMD faults when required Oliver O'Halloran
2017-04-12 5:51 ` Aneesh Kumar K.V [this message]
2017-04-11 17:42 ` [PATCH 3/9] powerpc/mm: Add _PAGE_DEVMAP for ppc64 Oliver O'Halloran
2017-04-12 0:19 ` Stephen Rothwell
2017-04-12 3:07 ` Aneesh Kumar K.V
2017-04-13 5:20 ` Aneesh Kumar K.V
2017-04-11 17:42 ` [PATCH 4/9] powerpc/mm: Reshuffle vmemmap_free() Oliver O'Halloran
2017-04-12 0:33 ` Stephen Rothwell
2017-04-11 17:42 ` [PATCH 5/9] powerpc/vmemmap: Add altmap support Oliver O'Halloran
2017-04-12 0:24 ` Balbir Singh
2017-04-11 17:42 ` [PATCH 6/9] powerpc, mm: Enable ZONE_DEVICE on powerpc Oliver O'Halloran
2017-04-12 0:25 ` Balbir Singh
2017-04-12 0:43 ` Stephen Rothwell
2017-04-12 2:03 ` Michael Ellerman
2017-04-11 17:42 ` [PATCH 7/9] powerpc/mm: Wire up ioremap_cache Oliver O'Halloran
2017-04-23 11:53 ` [7/9] " Michael Ellerman
2017-04-11 17:42 ` [PATCH 8/9] powerpc/mm: Wire up hpte_removebolted for powernv Oliver O'Halloran
2017-04-11 22:50 ` Anton Blanchard
2017-04-12 0:18 ` Stephen Rothwell
2017-04-12 3:30 ` Rashmica Gupta
2017-04-12 1:53 ` Balbir Singh
2017-04-13 4:21 ` Oliver O'Halloran
2017-04-13 10:10 ` Michael Ellerman
2017-04-11 17:42 ` [PATCH 9/9] powerpc: Add pmem API support Oliver O'Halloran
2017-04-11 18:22 ` ZONE_DEVICE and pmem API support for powerpc Dan Williams
2017-04-12 9:14 ` Oliver O'Halloran
2017-04-12 1:10 ` Stephen Rothwell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8760iaqil4.fsf@skywalker.in.ibm.com \
--to=aneesh.kumar@linux$(echo .)vnet.ibm.com \
--cc=arbab@linux$(echo .)vnet.ibm.com \
--cc=bsingharora@gmail$(echo .)com \
--cc=linux-mm@kvack$(echo .)org \
--cc=linux-nvdimm@lists$(echo .)01.org \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=oohall@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox