[PATCH] Performance Stats: Kernel patch
Maxim Uvarov
muvarov at ru.mvista.com
Thu May 10 20:22:54 EST 2007
Linas Vepstas wrote:
>Hi,
>
>On Tue, May 08, 2007 at 04:26:51PM +0000, Maxim Uvarov wrote:
>
>
>>Patch makes available to the user the following
>>task and process performance statistics:
>>
>>
>
>[...]
>
>
>
>>diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
>>index 5e47683..26f0cc0 100644
>>--- a/arch/i386/kernel/entry.S
>>+++ b/arch/i386/kernel/entry.S
>>@@ -331,6 +331,7 @@ sysenter_past_esp:
>> CFI_ADJUST_CFA_OFFSET 4
>> SAVE_ALL
>> GET_THREAD_INFO(%ebp)
>>+ incl TI_syscall_count(%ebp) # Increment syscalls counter
>>
>>
>
>Other arches have this protected with #ifdef CONFIG_TASKSTATS
>why not here?
>
>
>
Thank you. It should be protected.
>>diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
>>index c03e829..329c2f8 100644
>>--- a/arch/powerpc/kernel/entry_32.S
>>+++ b/arch/powerpc/kernel/entry_32.S
>>@@ -202,6 +202,11 @@ _GLOBAL(DoSyscall)
>> bl do_show_syscall
>> #endif /* SHOW_SYSCALLS */
>> rlwinm r10,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
>>+#ifdef CONFIG_THREAD_PERF_STAT_SYSC
>>+ lwz r11,TI_SYSC_CNT(r10)
>>+ addi r11,r11,1
>>+ stw r11,TI_SYSC_CNT(r10)
>>+#endif /* CONFIG_THREAD_PERF_STAT_SYSC */
>>
>>
>
>Why not CONFIG_TASKSTATS, as in entry_64.S ?
>
>Actually, grep shows that CONFIG_THREAD_PERF_STAT_SYSC is not defined
>anywhere.
>
>
>
This is mistake, thank you. I have to be more considerate.
>>diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
>>index 9f5dac6..9fd97df 100644
>>--- a/arch/x86_64/kernel/entry.S
>>+++ b/arch/x86_64/kernel/entry.S
>>@@ -229,6 +229,7 @@ ENTRY(system_call)
>> movq %rcx,RIP-ARGOFFSET(%rsp)
>> CFI_REL_OFFSET rip,RIP-ARGOFFSET
>> GET_THREAD_INFO(%rcx)
>>+ addq $1, threadinfo_syscall_count(%rcx) # Increment syscalls counter
>>
>>
>
>again, #ifdef CONFIG_TASKSTATS,
>
>--linas
>
>
In general I had the following idea. Defend with CONFIG_TASKSTATS all
syscall increment counters in arch/*/entry.S code. It will allow to
avoid this overhead if task stats interface is not supported by kernel.
The overhead is too small but, it is not needed to increment counters
without interface
to get them.
In first version of patch I have used only /proc interface. And it is
available now.
So I don't really sure if defines are needed in entry.S code. I tried
to do
some tests and it is impossible to catch the performance difference (small
overhead).
More information about the Linuxppc-dev
mailing list