Re: x86_64 Compiler Output Kernel Bloat v4.4

From: Jeff Merkey
Date: Tue Jan 19 2016 - 10:47:21 EST


On 1/19/16, Jeff Merkey <linux.mdb@xxxxxxxxx> wrote:
> On 1/19/16, Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
>> On Mon, Jan 18, 2016 at 02:45:14PM -0700, Jeff Merkey wrote:
>>
>> SNIP
>>
>>> > 0xffffffffa073e019 E8C2579FE0 call
>>> > touch_softlockup_watchdog_sync
>>> > 0xffffffffa073e01e E87D2B9BE0 call clocksource_touch_watchdog
>>> > 0xffffffffa073e023 E8F8099AE0 call rcu_cpu_stall_reset
>>> > 0xffffffffa073e028 E893579FE0 call touch_nmi_watchdog
>>> > 0xffffffffa073e02d 5D pop rbp
>>> > 0xffffffffa073e02e 6690 data16
>>> > 0xffffffffa073e030 C3 ret
>>> > 0xffffffffa073e031 6666666666662E0F1F840000000000 nop cs:WORD PTR
>>> > [rax+rax]=0x0000
>>> > mdb|mdb:
>>> > 0xffffffffa073e040 0F1F440000 nop DWORD PTR [rax+rax]=0x0 <<
>>> > 0xffffffffa073e045 55 push rbp
>>> > 0xffffffffa073e046 4889E5 mov rbp,rsp
>>> > 0xffffffffa073e049 4157 push r15
>>> > 0xffffffffa073e04b 4156 push r14
>>> > 0xffffffffa073e04d 4989FE mov r14,rdi
>>> > 0xffffffffa073e050 4155 push r13
>>> > (0)> g
>>> >
>>> > Jeff
>>> >
>>>
>>> I think xor eax,eax is a lot shorter and fewer bytes.
>>
>> that 5 byte nop gets replaced by call instruction once the
>> function trace is enabled
>>
>> explained in CONFIG_FUNCTION_TRACER option doc:
>>
>>
>> config FUNCTION_TRACER
>> bool "Kernel Function Tracer"
>> depends on HAVE_FUNCTION_TRACER
>> select KALLSYMS
>> select GENERIC_TRACER
>> select CONTEXT_SWITCH_TRACER
>> help
>> Enable the kernel to trace every kernel function. This is done
>> by using a compiler feature to insert a small, 5-byte
>> No-Operation
>> instruction at the beginning of every kernel function, which
>> NOP
>> sequence is then dynamically patched into a tracer call when
>> tracing is enabled by the administrator. If it's runtime
>> disabled
>> (the bootup default), then the overhead of the instructions is
>> very
>> small and not measurable even in micro-benchmarks.
>>
>> jirka
>>
>
> Takes up a lot of space since linux has so monay small functions.
> Someone sent me the ftrace stuff and I looked over it. Thanks.
>
> Jeff
>


I'll check my CONFIG and see if there's a way to turn this off.
vmlinux.o is at 385MB on my build -- about 20% of that is this NOP
instruction for a trace program that in most cases is probably never
used. Oink ... Oink ... Oink ...

:-)

Jeff