From: David Rientjes <rientjes@google.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Andrea Arcangeli <aarcange@redhat.com>
Subject: Re: [PATCH] mm: Flush the TLB for a single address in a huge page
Date: Wed, 22 Jul 2015 14:39:34 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.10.1507221436350.21468@chino.kir.corp.google.com> (raw)
In-Reply-To: <1437585214-22481-1-git-send-email-catalin.marinas@arm.com>
On Wed, 22 Jul 2015, Catalin Marinas wrote:
> When the page table entry is a huge page (and not a table), there is no
> need to flush the TLB by range. This patch changes flush_tlb_range() to
> flush_tlb_page() in functions where we know the pmd entry is a huge
> page.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andrea Arcangeli <aarcange@redhat.com>
> ---
>
> Hi,
>
> That's just a minor improvement but it saves iterating over each small
> page in a huge page when a single TLB entry is used (we already have a
> similar assumption in __tlb_adjust_range).
>
For x86 smp, this seems to mean the difference between unconditional
flush_tlb_page() and local_flush_tlb() due to
tlb_single_page_flush_ceiling, so I don't think this just removes the
iteration.
> Thanks.
>
> mm/pgtable-generic.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c
> index 6b674e00153c..ff17eca26211 100644
> --- a/mm/pgtable-generic.c
> +++ b/mm/pgtable-generic.c
> @@ -67,7 +67,7 @@ int pmdp_set_access_flags(struct vm_area_struct *vma,
> VM_BUG_ON(address & ~HPAGE_PMD_MASK);
> if (changed) {
> set_pmd_at(vma->vm_mm, address, pmdp, entry);
> - flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
> + flush_tlb_page(vma, address);
> }
> return changed;
> #else /* CONFIG_TRANSPARENT_HUGEPAGE */
> @@ -101,7 +101,7 @@ int pmdp_clear_flush_young(struct vm_area_struct *vma,
> #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
> young = pmdp_test_and_clear_young(vma, address, pmdp);
> if (young)
> - flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
> + flush_tlb_page(vma, address);
> return young;
> }
> #endif
> @@ -128,7 +128,7 @@ pmd_t pmdp_huge_clear_flush(struct vm_area_struct *vma, unsigned long address,
> VM_BUG_ON(address & ~HPAGE_PMD_MASK);
> VM_BUG_ON(!pmd_trans_huge(*pmdp));
> pmd = pmdp_huge_get_and_clear(vma->vm_mm, address, pmdp);
> - flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
> + flush_tlb_page(vma, address);
> return pmd;
> }
> #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
> @@ -143,7 +143,7 @@ void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
> VM_BUG_ON(address & ~HPAGE_PMD_MASK);
> set_pmd_at(vma->vm_mm, address, pmdp, pmd);
> /* tlb flush only to serialize against gup-fast */
> - flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
> + flush_tlb_page(vma, address);
> }
> #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
> #endif
> @@ -195,7 +195,7 @@ void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
> {
> pmd_t entry = *pmdp;
> set_pmd_at(vma->vm_mm, address, pmdp, pmd_mknotpresent(entry));
> - flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
> + flush_tlb_page(vma, address);
> }
> #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
> #endif
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-07-22 21:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-22 17:13 Catalin Marinas
2015-07-22 21:39 ` David Rientjes [this message]
2015-07-22 22:48 ` Catalin Marinas
2015-07-22 23:05 ` Dave Hansen
2015-07-23 10:49 ` Catalin Marinas
2015-07-23 14:13 ` Andrea Arcangeli
2015-07-23 14:41 ` Dave Hansen
2015-07-23 15:58 ` Andrea Arcangeli
2015-07-23 16:52 ` Dave Hansen
2015-07-23 16:16 ` Catalin Marinas
2015-07-23 16:55 ` Dave Hansen
2015-07-23 17:13 ` Andrea Arcangeli
2015-07-23 16:49 ` Catalin Marinas
2015-07-24 7:17 ` Martin Schwidefsky
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=alpine.DEB.2.10.1507221436350.21468@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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