Skip to contentSkip to conversation

x86, tlb: small cleanup for native_flush_tlb_others

PATCH In review Xiao Guangrong 2 participants 5 messages Mar 14, 2011 – Mar 15, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86, tlb: small cleanup for native_flush_tlb_others

Use smp_processor_id instead of get_cpu and put_cpu since the caller has already disabled preemption

---
 arch/x86/mm/tlb.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
arch/x86/mm/tlb.c +1 -2
index 6acc724..92849d0 100644
@@ -211,11 +211,10 @@ void native_flush_tlb_others(const struct cpumask *cpumask,
 	if (is_uv_system()) {
 		unsigned int cpu;
 
-		cpu = get_cpu();
+		cpu = smp_processor_id();
 		cpumask = uv_flush_tlb_others(cpumask, mm, va, cpu);
 		if (cpumask)
 			flush_tlb_others_ipi(cpumask, mm, va);
-		put_cpu();
 		return;
 	}
 	flush_tlb_others_ipi(cpumask, mm, va);
Signature · 1 line
1.7.4
#1 lore raw
Quoted 13 lines · Xiao Guangrong

Use smp_processor_id instead of get_cpu and put_cpu since the caller has already disabled preemption

---
 arch/x86/mm/tlb.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
arch/x86/mm/tlb.c +0 -0
index 6acc724..92849d0 100644

arch/x86/mm/tlb.c void native_flush_tlb_others(const struct cpumask *cpumask, · line 218

Quoted 10 lines
arch/x86/mm/tlb.c +1 -2
@@ -211,11 +211,10 @@ void native_flush_tlb_others(const struct cpumask *cpumask,
 	if (is_uv_system()) {
 		unsigned int cpu;
 
-		cpu = get_cpu();
+		cpu = smp_processor_id();
 		cpumask = uv_flush_tlb_others(cpumask, mm, va, cpu);
 		if (cpumask)
 			flush_tlb_others_ipi(cpumask, mm, va);
-		put_cpu();
 		return;

There's multiple callers. Could you please update the changelog with the list of callers and a statement that all of them disable preemption already?

Thanks,

Ingo

#2 lore raw

Also, the title of the patch should be something like 'small micro-optimization' - as it's not just a cleanup, it has side-effects on the code.

Thanks,

Ingo

#3 lore raw
In reply to Ingo Molnar
Quoted 19 lines · Ingo Molnar
Quoted 16 lines · Xiao Guangrong

Use smp_processor_id instead of get_cpu and put_cpu since the caller has already disabled preemption

---
 arch/x86/mm/tlb.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
arch/x86/mm/tlb.c +0 -0
index 6acc724..92849d0 100644
@@ -211,11 +211,10 @@ void native_flush_tlb_others(const struct cpumask *cpumask,
 	if (is_uv_system()) {
 		unsigned int cpu;
 
Quoted 11 lines

arch/x86/mm/tlb.c void native_flush_tlb_others(const struct cpumask *cpumask, · line 218

Quoted 7 lines
arch/x86/mm/tlb.c +1 -2
-		cpu = get_cpu();
+		cpu = smp_processor_id();
 		cpumask = uv_flush_tlb_others(cpumask, mm, va, cpu);
 		if (cpumask)
 			flush_tlb_others_ipi(cpumask, mm, va);
-		put_cpu();
 		return;

There's multiple callers. Could you please update the changelog with the list of callers and a statement that all of them disable preemption already?

Thanks Ingo, there is the new version.

From: Xiao Guangrong <[email protected]>
Subject: [PATCH] x86, tlb: small micro-optimization for native_flush_tlb_others

native_flush_tlb_others is called from:
flush_tlb_current_task
flush_tlb_mm
flush_tlb_page

All these functions disable preemption explicitly, so we can use smp_processor_id instead of get_cpu and put_cpu

---
 arch/x86/mm/tlb.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
arch/x86/mm/tlb.c +1 -2
index 6acc724..92849d0 100644
@@ -211,11 +211,10 @@ void native_flush_tlb_others(const struct cpumask *cpumask,
 	if (is_uv_system()) {
 		unsigned int cpu;
 
-		cpu = get_cpu();
+		cpu = smp_processor_id();
 		cpumask = uv_flush_tlb_others(cpumask, mm, va, cpu);
 		if (cpumask)
 			flush_tlb_others_ipi(cpumask, mm, va);
-		put_cpu();
 		return;
 	}
 	flush_tlb_others_ipi(cpumask, mm, va);
Signature · 1 line
1.7.4
#4 lore raw

[tip:x86/mm] x86, tlb, UV: Do small micro-optimization for native_flush_tlb_others()

Commit-ID:  25542c646afbf14c43fa7d2b443055cadb73b07a
Gitweb:     http://git.kernel.org/tip/25542c646afbf14c43fa7d2b443055cadb73b07a
Author:     Xiao Guangrong <[email protected]>
AuthorDate: Tue, 15 Mar 2011 09:57:37 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 15 Mar 2011 08:30:34 +0100

x86, tlb, UV: Do small micro-optimization for native_flush_tlb_others()

native_flush_tlb_others() is called from:

flush_tlb_current_task()
flush_tlb_mm()
flush_tlb_page()

All these functions disable preemption explicitly, so we can use smp_processor_id() instead of get_cpu() and put_cpu().

LKML-Reference: <[email protected]>

---
 arch/x86/mm/tlb.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
arch/x86/mm/tlb.c +1 -2
index 55272d7..d6c0418 100644
@@ -208,11 +208,10 @@ void native_flush_tlb_others(const struct cpumask *cpumask,
 	if (is_uv_system()) {
 		unsigned int cpu;
 
-		cpu = get_cpu();
+		cpu = smp_processor_id();
 		cpumask = uv_flush_tlb_others(cpumask, mm, va, cpu);
 		if (cpumask)
 			flush_tlb_others_ipi(cpumask, mm, va);
-		put_cpu();
 		return;
 	}
 	flush_tlb_others_ipi(cpumask, mm, va);