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: Rusell King <rmk@arm.linux.org.uk>, Ian Molton <spyro@f2s.com>,
	William Irwin <wli@holomorphy.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jeff Dike <jdike@addtoit.com>,
	Blaisorblade <blaisorblade@yahoo.it>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 12/21] mm: arches skip ptlock
Date: Thu, 13 Oct 2005 01:59:24 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.61.0510130156280.4060@goblin.wat.veritas.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0510130143240.4060@goblin.wat.veritas.com>

Convert those few architectures which are calling pud_alloc, pmd_alloc,
pte_alloc_map on a user mm, not to take the page_table_lock first, nor
drop it after.  Each of these can continue to use pte_alloc_map, no need
to change over to pte_alloc_map_lock, they're neither racy nor swappable.

In the sparc64 io_remap_pfn_range, flush_tlb_range then falls outside of
the page_table_lock: that's okay, on sparc64 it's like flush_tlb_mm, and
that has always been called from outside of page_table_lock in dup_mmap.

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

 arch/arm/mm/mm-armv.c     |   14 --------------
 arch/arm26/mm/memc.c      |   15 ---------------
 arch/sparc/mm/generic.c   |    4 +---
 arch/sparc64/mm/generic.c |    6 ++----
 arch/um/kernel/skas/mmu.c |    3 ---
 5 files changed, 3 insertions(+), 39 deletions(-)

--- mm11/arch/arm/mm/mm-armv.c	2005-09-21 12:16:12.000000000 +0100
+++ mm12/arch/arm/mm/mm-armv.c	2005-10-11 23:56:41.000000000 +0100
@@ -180,11 +180,6 @@ pgd_t *get_pgd_slow(struct mm_struct *mm
 
 	if (!vectors_high()) {
 		/*
-		 * This lock is here just to satisfy pmd_alloc and pte_lock
-		 */
-		spin_lock(&mm->page_table_lock);
-
-		/*
 		 * On ARM, first page must always be allocated since it
 		 * contains the machine vectors.
 		 */
@@ -201,23 +196,14 @@ pgd_t *get_pgd_slow(struct mm_struct *mm
 		set_pte(new_pte, *init_pte);
 		pte_unmap_nested(init_pte);
 		pte_unmap(new_pte);
-
-		spin_unlock(&mm->page_table_lock);
 	}
 
 	return new_pgd;
 
 no_pte:
-	spin_unlock(&mm->page_table_lock);
 	pmd_free(new_pmd);
-	free_pages((unsigned long)new_pgd, 2);
-	return NULL;
-
 no_pmd:
-	spin_unlock(&mm->page_table_lock);
 	free_pages((unsigned long)new_pgd, 2);
-	return NULL;
-
 no_pgd:
 	return NULL;
 }
--- mm11/arch/arm26/mm/memc.c	2005-10-11 23:55:53.000000000 +0100
+++ mm12/arch/arm26/mm/memc.c	2005-10-11 23:56:41.000000000 +0100
@@ -79,12 +79,6 @@ pgd_t *get_pgd_slow(struct mm_struct *mm
 		goto no_pgd;
 
 	/*
-	 * This lock is here just to satisfy pmd_alloc and pte_lock
-         * FIXME: I bet we could avoid taking it pretty much altogether
-	 */
-	spin_lock(&mm->page_table_lock);
-
-	/*
 	 * On ARM, first page must always be allocated since it contains
 	 * the machine vectors.
 	 */
@@ -113,23 +107,14 @@ pgd_t *get_pgd_slow(struct mm_struct *mm
 	memcpy(new_pgd + FIRST_KERNEL_PGD_NR, init_pgd + FIRST_KERNEL_PGD_NR,
 		(PTRS_PER_PGD - FIRST_KERNEL_PGD_NR) * sizeof(pgd_t));
 
-	spin_unlock(&mm->page_table_lock);
-
 	/* update MEMC tables */
 	cpu_memc_update_all(new_pgd);
 	return new_pgd;
 
 no_pte:
-	spin_unlock(&mm->page_table_lock);
 	pmd_free(new_pmd);
-	free_pgd_slow(new_pgd);
-	return NULL;
-
 no_pmd:
-	spin_unlock(&mm->page_table_lock);
 	free_pgd_slow(new_pgd);
-	return NULL;
-
 no_pgd:
 	return NULL;
 }
--- mm11/arch/sparc/mm/generic.c	2005-09-21 12:16:20.000000000 +0100
+++ mm12/arch/sparc/mm/generic.c	2005-10-11 23:56:41.000000000 +0100
@@ -78,9 +78,8 @@ int io_remap_pfn_range(struct vm_area_st
 	dir = pgd_offset(mm, from);
 	flush_cache_range(vma, beg, end);
 
-	spin_lock(&mm->page_table_lock);
 	while (from < end) {
-		pmd_t *pmd = pmd_alloc(current->mm, dir, from);
+		pmd_t *pmd = pmd_alloc(mm, dir, from);
 		error = -ENOMEM;
 		if (!pmd)
 			break;
@@ -90,7 +89,6 @@ int io_remap_pfn_range(struct vm_area_st
 		from = (from + PGDIR_SIZE) & PGDIR_MASK;
 		dir++;
 	}
-	spin_unlock(&mm->page_table_lock);
 
 	flush_tlb_range(vma, beg, end);
 	return error;
--- mm11/arch/sparc64/mm/generic.c	2005-09-21 12:16:20.000000000 +0100
+++ mm12/arch/sparc64/mm/generic.c	2005-10-11 23:56:41.000000000 +0100
@@ -132,9 +132,8 @@ int io_remap_pfn_range(struct vm_area_st
 	dir = pgd_offset(mm, from);
 	flush_cache_range(vma, beg, end);
 
-	spin_lock(&mm->page_table_lock);
 	while (from < end) {
-		pud_t *pud = pud_alloc(current->mm, dir, from);
+		pud_t *pud = pud_alloc(mm, dir, from);
 		error = -ENOMEM;
 		if (!pud)
 			break;
@@ -144,8 +143,7 @@ int io_remap_pfn_range(struct vm_area_st
 		from = (from + PGDIR_SIZE) & PGDIR_MASK;
 		dir++;
 	}
-	flush_tlb_range(vma, beg, end);
-	spin_unlock(&mm->page_table_lock);
 
+	flush_tlb_range(vma, beg, end);
 	return error;
 }
--- mm11/arch/um/kernel/skas/mmu.c	2005-09-21 12:16:21.000000000 +0100
+++ mm12/arch/um/kernel/skas/mmu.c	2005-10-11 23:56:41.000000000 +0100
@@ -28,7 +28,6 @@ static int init_stub_pte(struct mm_struc
 	pmd_t *pmd;
 	pte_t *pte;
 
-	spin_lock(&mm->page_table_lock);
 	pgd = pgd_offset(mm, proc);
 	pud = pud_alloc(mm, pgd, proc);
 	if (!pud)
@@ -63,7 +62,6 @@ static int init_stub_pte(struct mm_struc
 	*pte = mk_pte(virt_to_page(kernel), __pgprot(_PAGE_PRESENT));
 	*pte = pte_mkexec(*pte);
 	*pte = pte_wrprotect(*pte);
-	spin_unlock(&mm->page_table_lock);
 	return(0);
 
  out_pmd:
@@ -71,7 +69,6 @@ static int init_stub_pte(struct mm_struc
  out_pte:
 	pmd_free(pmd);
  out:
-	spin_unlock(&mm->page_table_lock);
 	return(-ENOMEM);
 }
 

  parent reply	other threads:[~2005-10-13  1:00 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 ` Hugh Dickins [this message]
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 ` [PATCH 15/21] mm: flush_tlb_range outside ptlock Hugh Dickins
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.0510130156280.4060@goblin.wat.veritas.com \
    --to=hugh@veritas.com \
    --cc=akpm@osdl.org \
    --cc=blaisorblade@yahoo.it \
    --cc=davem@davemloft.net \
    --cc=jdike@addtoit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    --cc=spyro@f2s.com \
    --cc=wli@holomorphy.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®