mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@osdl.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	Tony Luck <tony.luck@intel.com>, Matthew Wilcox <matthew@wil.cx>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 15/21] mm: flush_tlb_range outside ptlock
Date: Thu, 13 Oct 2005 02:16:40 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.61.0510130214570.4343@goblin.wat.veritas.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0510130143240.4060@goblin.wat.veritas.com>

There was one small but very significant change in the previous patch:
mprotect's flush_tlb_range fell outside the page_table_lock: as it is
in 2.4, but that doesn't prove it safe in 2.6.

On some architectures flush_tlb_range comes to the same as flush_tlb_mm,
which has always been called from outside page_table_lock in dup_mmap,
and is so proved safe.  Others required a deeper audit: I could find no
reliance on page_table_lock in any; but in ia64 and parisc found some
code which looks a bit as if it might want preemption disabled.  That
won't do any actual harm, so pending a decision from the maintainers,
disable preemption there.

Remove comments on page_table_lock from flush_tlb_mm, flush_tlb_range
and flush_tlb_page entries in cachetlb.txt: they were rather misleading
(what generic code does is different from what usually happens), the
rules are now changing, and it's not yet clear where we'll end up (will
the generic tlb_flush_mmu happen always under lock? never under lock?
or sometimes under and sometimes not?).

Signed-off-by: Hugh Dickins <hugh@veritas.com>
---

 Documentation/cachetlb.txt    |    9 ---------
 arch/ia64/mm/tlb.c            |    2 ++
 include/asm-parisc/tlbflush.h |    3 ++-
 3 files changed, 4 insertions(+), 10 deletions(-)

--- mm14/Documentation/cachetlb.txt	2005-06-17 20:48:29.000000000 +0100
+++ mm15/Documentation/cachetlb.txt	2005-10-11 23:57:25.000000000 +0100
@@ -49,9 +49,6 @@ changes occur:
 	page table operations such as what happens during
 	fork, and exec.
 
-	Platform developers note that generic code will always
-	invoke this interface without mm->page_table_lock held.
-
 3) void flush_tlb_range(struct vm_area_struct *vma,
 			unsigned long start, unsigned long end)
 
@@ -72,9 +69,6 @@ changes occur:
 	call flush_tlb_page (see below) for each entry which may be
 	modified.
 
-	Platform developers note that generic code will always
-	invoke this interface with mm->page_table_lock held.
-
 4) void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
 
 	This time we need to remove the PAGE_SIZE sized translation
@@ -93,9 +87,6 @@ changes occur:
 
 	This is used primarily during fault processing.
 
-	Platform developers note that generic code will always
-	invoke this interface with mm->page_table_lock held.
-
 5) void flush_tlb_pgtables(struct mm_struct *mm,
 			   unsigned long start, unsigned long end)
 
--- mm14/arch/ia64/mm/tlb.c	2005-06-17 20:48:29.000000000 +0100
+++ mm15/arch/ia64/mm/tlb.c	2005-10-11 23:57:25.000000000 +0100
@@ -155,10 +155,12 @@ flush_tlb_range (struct vm_area_struct *
 # ifdef CONFIG_SMP
 	platform_global_tlb_purge(start, end, nbits);
 # else
+	preempt_disable();
 	do {
 		ia64_ptcl(start, (nbits<<2));
 		start += (1UL << nbits);
 	} while (start < end);
+	preempt_enable();
 # endif
 
 	ia64_srlz_i();			/* srlz.i implies srlz.d */
--- mm14/include/asm-parisc/tlbflush.h	2004-12-24 21:37:30.000000000 +0000
+++ mm15/include/asm-parisc/tlbflush.h	2005-10-11 23:57:25.000000000 +0100
@@ -69,7 +69,7 @@ static inline void flush_tlb_range(struc
 	if (npages >= 512)  /* XXX arbitrary, should be tuned */
 		flush_tlb_all();
 	else {
-
+		preempt_disable();
 		mtsp(vma->vm_mm->context,1);
 		if (split_tlb) {
 			purge_tlb_start();
@@ -87,6 +87,7 @@ static inline void flush_tlb_range(struc
 			}
 			purge_tlb_end();
 		}
+		preempt_enable();
 	}
 }
 

  parent reply	other threads:[~2005-10-13  1:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-13  0:44 [PATCH 00/21] mm: page fault scalability nearer Hugh Dickins
2005-10-13  0:45 ` [PATCH 01/21] mm: copy_one_pte inc rss Hugh Dickins
2005-10-13  0:46 ` [PATCH 02/21] mm: zap_pte_range dec rss Hugh Dickins
2005-10-13  0:47 ` [PATCH 03/21] mm: do_swap_page race major Hugh Dickins
2005-10-13  0:47 ` [PATCH 04/21] mm: do_mremap current mm Hugh Dickins
2005-10-13  0:48 ` [PATCH 05/21] mm: zap_pte out of line Hugh Dickins
2005-10-13  0:50 ` [PATCH 06/21] mm: update_hiwaters just in time Hugh Dickins
2005-10-13  1:17   ` Christoph Lameter
2005-10-13 19:18     ` Jay Lan
2005-10-13  0:52 ` [PATCH 07/21] mm: mm_struct hiwaters moved Hugh Dickins
2005-10-13  0:53 ` [PATCH 08/21] mm: ia64 use expand_upwards Hugh Dickins
2005-10-13  0:55 ` [PATCH 09/21] mm: init_mm without ptlock Hugh Dickins
2005-10-13  0:55 ` [PATCH 10/21] mm: ptd_alloc inline and out Hugh Dickins
2005-10-13  0:56 ` [PATCH 11/21] mm: ptd_alloc take ptlock Hugh Dickins
2005-10-13  0:59 ` [PATCH 12/21] mm: arches skip ptlock Hugh Dickins
2005-10-13  1:13 ` [PATCH 13/21] mm: page fault handler locking Hugh Dickins
2005-10-13  1:14 ` [PATCH 14/21] mm: pte_offset_map_lock loops Hugh Dickins
2005-10-13  1:16 ` Hugh Dickins [this message]
2005-10-13  1:17 ` [PATCH 16/21] mm: unlink vma before pagetables Hugh Dickins
2005-10-13  1:18 ` [PATCH 17/21] mm: unmap_vmas with inner ptlock Hugh Dickins
2005-10-13  1:20 ` [PATCH 18/21] mm: xip_unmap ZERO_PAGE fix Hugh Dickins
2005-10-13 12:39   ` Carsten Otte
2005-10-13  1:21 ` [PATCH 19/21] mm: rmap with inner ptlock Hugh Dickins
2005-10-13  1:22 ` [PATCH 20/21] mm: kill check_user_page_readable Hugh Dickins
2005-10-13  1:23 ` [PATCH 21/21] mm: follow_page with inner ptlock Hugh Dickins

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=Pine.LNX.4.61.0510130214570.4343@goblin.wat.veritas.com \
    --to=hugh@veritas.com \
    --cc=akpm@osdl.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=tony.luck@intel.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

all inboxes | Powered by JetHome®