Re: Performance Stats: Kernel patch

From: Eric Dumazet
Date: Wed Apr 04 2007 - 09:46:50 EST


On Wed, 04 Apr 2007 17:15:43 +0400
Maxim Uvarov <muvarov@xxxxxxxxxxxxx> wrote:

>
> --- linux-2.6.18.orig/arch/i386/kernel/entry.S
> +++ linux-2.6.18/arch/i386/kernel/entry.S
> @@ -394,6 +394,9 @@ syscall_exit:
> cli # make sure we don't miss an
> interrupt
> # setting need_resched or sigpending
> # between sampling and the iret
> +#ifdef CONFIG_THREAD_PERF_STAT_SYSC
> + call inc_syscallcnt # Increment syscalls counter
> current->sysc_cnt
> +#endif /* CONFIG_THREAD_PERF_STAT_SYSC */

Please dont call a function to do one increment !

You are touching one of the most critical part of the kernel...

Also, dont do this while interrupts are masked, this is not necessary.

Maybe better to place sysc_cnt in 'struct thread_info' because %ebp point to it.

Also you missed the fact that syscalls on i386 can use sysenter (around line 343)

> TRACE_IRQS_OFF
> movl TI_flags(%ebp), %ecx
> testw $_TIF_ALLWORK_MASK, %cx # current->work
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/