This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3] Adding a some new probes to the networking.stp tapset


On 09/17/2009 02:12 PM, David Smith wrote:
> Because of the way the optimizer works, reusing those temporary
> variables probably isn't a good idea.  If you call that function and
> only use 'new_mac', here's the pass 2 output:
> 
> ====
> kernel.function("dev_set_mac_address@net/core/dev.c:3775") /*
> pc=_stext+0x308ab1 */ /* <- netdev.change_mac =
> kernel.function("dev_set_mac_address") <- netdev.change_mac */
>   # locals
>   zero:long
>   one:long
>   two:long
>   three:long
>   four:long
>   five:long
>   new_mac:string
> {
> (zero) = (_dwarf_tvar_get_dev_2())
> (one) = (_dwarf_tvar_get_dev_3())
> (two) = (_dwarf_tvar_get_dev_4())
> (three) = (_dwarf_tvar_get_dev_5())
> (four) = (_dwarf_tvar_get_dev_6())
> (five) = (_dwarf_tvar_get_dev_7())
> (zero) = (_dwarf_tvar_get_sa_8())
> (one) = (_dwarf_tvar_get_sa_9())
> (two) = (_dwarf_tvar_get_sa_10())
> (three) = (_dwarf_tvar_get_sa_11())
> (four) = (_dwarf_tvar_get_sa_12())
> (five) = (_dwarf_tvar_get_sa_13())
> (new_mac) = (sprintf("%02x:%02x:%02x:%02x:%02x:%02x", zero, one, two,
> three, four, five))
> printf("%s", new_mac)
> }
> ====
> 
> The optimizer removed the assignment to old_mac, but it couldn't
> optimize the 1st six assignments and their _dwarf_tvar_get_dev_*
> function calls away.

Ouch - someone care to write a shadowed-assignment optimization pass? :)

> So, I think it would be better to trade off the six assignments and the
> call to the _dwarf_tvar_get_dev_* and make separate sets of temporary
> variables.  You'll end up increasing the number of temporaries that way,
> but it should execute faster if only one of the mac addresses is used.

Actually, I think the cleanest way is to just avoid the temps altogether
and read the values directly as sprintf arguments.

I already pushed these patches to git, but my message saying so didn't
hit the list due to mail routing issues.  I'll go ahead and fix this up
then as a penance for my eagerness...

Josh


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]