lkml.org 
[lkml]   [2011]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] x86, tlb: small cleanup for native_flush_tlb_others
On 03/14/2011 08:33 PM, Ingo Molnar wrote:
>
> * Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> wrote:
>
>> Use smp_processor_id instead of get_cpu and put_cpu since
>> the caller has already disabled preemption
>>
>> Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
>> ---
>> arch/x86/mm/tlb.c | 3 +--
>> 1 files changed, 1 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
>> index 6acc724..92849d0 100644
>> --- a/arch/x86/mm/tlb.c
>> +++ b/arch/x86/mm/tlb.c
>> @@ -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, there is the new version.

From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
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

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
---
arch/x86/mm/tlb.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 6acc724..92849d0 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -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);
--
1.7.4


\
 
 \ /
  Last update: 2011-03-15 02:59    [W:0.855 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site