From: Ingo Molnar <mingo@kernel.org>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: Paul Turner <pjt@google.com>,
Lee Schermerhorn <Lee.Schermerhorn@hp.com>,
Christoph Lameter <cl@linux.com>, Rik van Riel <riel@redhat.com>,
Mel Gorman <mgorman@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
Andrea Arcangeli <aarcange@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Thomas Gleixner <tglx@linutronix.de>,
Hugh Dickins <hughd@google.com>,
Michel Lespinasse <walken@google.com>
Subject: [PATCH 01/19] mm/generic: Only flush the local TLB in ptep_set_access_flags()
Date: Fri, 16 Nov 2012 17:25:03 +0100 [thread overview]
Message-ID: <1353083121-4560-2-git-send-email-mingo@kernel.org> (raw)
In-Reply-To: <1353083121-4560-1-git-send-email-mingo@kernel.org>
From: Rik van Riel <riel@redhat.com>
The function ptep_set_access_flags() is only ever used to upgrade
access permissions to a page - i.e. they make it less restrictive.
That means the only negative side effect of not flushing remote
TLBs in this function is that other CPUs may incur spurious page
faults, if they happen to access the same address, and still have
a PTE with the old permissions cached in their TLB caches.
Having another CPU maybe incur a spurious page fault is faster
than always incurring the cost of a remote TLB flush, so replace
the remote TLB flush with a purely local one.
This should be safe on every architecture that correctly
implements flush_tlb_fix_spurious_fault() to actually invalidate
the local TLB entry that caused a page fault, as well as on
architectures where the hardware invalidates TLB entries that
cause page faults.
In the unlikely event that you are hitting what appears to be
an infinite loop of page faults, and 'git bisect' took you to
this changeset, your architecture needs to implement
flush_tlb_fix_spurious_fault() to actually flush the TLB entry.
Signed-off-by: Rik van Riel <riel@redhat.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michel Lespinasse <walken@google.com>
[ Changelog massage. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
mm/pgtable-generic.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c
index e642627..d8397da 100644
--- a/mm/pgtable-generic.c
+++ b/mm/pgtable-generic.c
@@ -12,8 +12,8 @@
#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
/*
- * Only sets the access flags (dirty, accessed, and
- * writable). Furthermore, we know it always gets set to a "more
+ * Only sets the access flags (dirty, accessed), as well as write
+ * permission. Furthermore, we know it always gets set to a "more
* permissive" setting, which allows most architectures to optimize
* this. We return whether the PTE actually changed, which in turn
* instructs the caller to do things like update__mmu_cache. This
@@ -27,7 +27,7 @@ int ptep_set_access_flags(struct vm_area_struct *vma,
int changed = !pte_same(*ptep, entry);
if (changed) {
set_pte_at(vma->vm_mm, address, ptep, entry);
- flush_tlb_page(vma, address);
+ flush_tlb_fix_spurious_fault(vma, address);
}
return changed;
}
--
1.7.11.7
--
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:[~2012-11-16 16:25 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-16 16:25 [PATCH 00/19] latest numa/base patches Ingo Molnar
2012-11-16 16:25 ` Ingo Molnar [this message]
2012-11-16 16:25 ` [PATCH 02/19] x86/mm: Only do a local tlb flush in ptep_set_access_flags() Ingo Molnar
2012-11-16 16:25 ` [PATCH 03/19] sched, numa, mm: Make find_busiest_queue() a method Ingo Molnar
2012-11-16 16:25 ` [PATCH 04/19] sched, numa, mm: Describe the NUMA scheduling problem formally Ingo Molnar
2012-11-25 6:07 ` abhishek agarwal
2012-11-25 6:09 ` abhishek agarwal
2012-11-16 16:25 ` [PATCH 05/19] sched, numa, mm, s390/thp: Implement pmd_pgprot() for s390 Ingo Molnar
2012-11-16 16:25 ` [PATCH 06/19] mm/thp: Preserve pgprot across huge page split Ingo Molnar
2012-11-16 16:25 ` [PATCH 07/19] x86/mm: Introduce pte_accessible() Ingo Molnar
2012-11-16 16:25 ` [PATCH 08/19] mm: Only flush the TLB when clearing an accessible pte Ingo Molnar
2012-11-16 16:25 ` [PATCH 09/19] sched, numa, mm, MIPS/thp: Add pmd_pgprot() implementation Ingo Molnar
2012-11-16 16:25 ` [PATCH 10/19] mm/pgprot: Move the pgprot_modify() fallback definition to mm.h Ingo Molnar
2012-11-16 16:25 ` [PATCH 11/19] mm/mpol: Make MPOL_LOCAL a real policy Ingo Molnar
2012-11-16 16:25 ` [PATCH 12/19] mm/mpol: Add MPOL_MF_NOOP Ingo Molnar
2012-11-16 16:25 ` [PATCH 13/19] mm/mpol: Check for misplaced page Ingo Molnar
2012-11-16 16:25 ` [PATCH 14/19] mm/mpol: Create special PROT_NONE infrastructure Ingo Molnar
2012-11-16 16:25 ` [PATCH 15/19] mm/mpol: Add MPOL_MF_LAZY Ingo Molnar
2012-11-16 16:25 ` [PATCH 16/19] numa, mm: Support NUMA hinting page faults from gup/gup_fast Ingo Molnar
2012-11-16 16:25 ` [PATCH 17/19] mm/migrate: Introduce migrate_misplaced_page() Ingo Molnar
2012-11-19 2:25 ` [PATCH 17/19, v2] " Ingo Molnar
2012-11-19 16:02 ` Rik van Riel
2012-11-16 16:25 ` [PATCH 18/19] mm/mpol: Use special PROT_NONE to migrate pages Ingo Molnar
2012-11-16 16:25 ` [PATCH 19/19] x86/mm: Completely drop the TLB flush from ptep_set_access_flags() Ingo Molnar
2012-11-17 8:35 ` [PATCH 00/19] latest numa/base patches Alex Shi
2012-11-17 8:40 ` Alex Shi
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=1353083121-4560-2-git-send-email-mingo@kernel.org \
--to=mingo@kernel.org \
--cc=Lee.Schermerhorn@hp.com \
--cc=a.p.zijlstra@chello.nl \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=pjt@google.com \
--cc=riel@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=walken@google.com \
/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;
as well as URLs for NNTP newsgroup(s).