All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: sparclinux@vger.kernel.org
Subject: Re: [PATCH] sparc64: Don't pass a pointer to xcall_flush_tlb_pending
Date: Fri, 19 Apr 2013 17:40:51 +0000	[thread overview]
Message-ID: <517181A3.5090905@oracle.com> (raw)
In-Reply-To: <516F0B8A.5070407@oracle.com>

Here's a lightly-tested incremental patch to yours that limits
smp_flush_tlb_page's  cross calls to the mm's active set.

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>

diff --git a/arch/sparc/include/asm/tlbflush_64.h b/arch/sparc/include/asm/tlbflush_64.h
index d4b56bb..f3c8a0f 100644
--- a/arch/sparc/include/asm/tlbflush_64.h
+++ b/arch/sparc/include/asm/tlbflush_64.h
@@ -54,21 +54,21 @@ do {	flush_tsb_kernel_range(start,end); \
 	__flush_tlb_kernel_range(start,end); \
 } while (0)
 
-#define global_flush_tlb_page(context, vaddr) \
-	__flush_tlb_page(context, vaddr)
+#define global_flush_tlb_page(mm, vaddr) \
+	__flush_tlb_page(CTX_HWBITS((mm)->context), vaddr)
 
 #else /* CONFIG_SMP */
 
 extern void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end);
-extern void smp_flush_tlb_page(unsigned long context, unsigned long vaddr);
+extern void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr);
 
 #define flush_tlb_kernel_range(start, end) \
 do {	flush_tsb_kernel_range(start,end); \
 	smp_flush_tlb_kernel_range(start, end); \
 } while (0)
 
-#define global_flush_tlb_page(context, vaddr) \
-	smp_flush_tlb_page(context, vaddr)
+#define global_flush_tlb_page(mm, vaddr) \
+	smp_flush_tlb_page(mm, vaddr)
 
 #endif /* ! CONFIG_SMP */
 
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 33bd996..1dee6e9 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -1108,10 +1108,16 @@ void smp_flush_tlb_pending(struct mm_struct *mm, unsigned long nr, unsigned long
 	put_cpu();
 }
 
-void smp_flush_tlb_page(unsigned long context, unsigned long vaddr)
+void smp_flush_tlb_page(struct mm_struct *mm, unsigned long vaddr)
 {
-	smp_cross_call(&xcall_flush_tlb_page,
-		       context, vaddr, 0);
+	unsigned long context = CTX_HWBITS(mm->context);
+	int cpu = get_cpu();
+
+	if (mm = current->mm && atomic_read(&mm->mm_users) = 1)
+		cpumask_copy(mm_cpumask(mm), cpumask_of(cpu));
+	else
+		smp_cross_call(&xcall_flush_tlb_page, context, vaddr, 0);
+
 	__flush_tlb_page(context, vaddr);
 }
 
diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
index 26ddb58..1e31b30 100644
--- a/arch/sparc/mm/tlb.c
+++ b/arch/sparc/mm/tlb.c
@@ -77,7 +77,7 @@ static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr,
 	}
 
 	if (!tb->active) {
-		global_flush_tlb_page(CTX_HWBITS(mm->context), vaddr);
+		global_flush_tlb_page(mm, vaddr);
 		flush_tsb_user_page(mm, vaddr);
 		return;
 	}

  parent reply	other threads:[~2013-04-19 17:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-17 20:52 [PATCH] sparc64: Don't pass a pointer to xcall_flush_tlb_pending Dave Kleikamp
2013-04-17 21:24 ` David Miller
2013-04-17 21:31 ` David Miller
2013-04-17 22:07 ` Dave Kleikamp
2013-04-17 22:44 ` David Miller
2013-04-19  0:51 ` David Miller
2013-04-19 14:46 ` Dave Kleikamp
2013-04-19 17:40 ` Dave Kleikamp [this message]
2013-04-19 17:41 ` David Miller
2013-04-19 18:03 ` Dave Kleikamp
2013-04-19 18:11 ` David Miller

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=517181A3.5090905@oracle.com \
    --to=dave.kleikamp@oracle.com \
    --cc=sparclinux@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.