Subject: Re: [PATCH] Performance Stats: Kernel patch

From: [email-masked] (Linas Vepstas)
Date: Tue, 8 May 2007 18:32:00 -0500

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?

> 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.

> 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