[ovs-dev] [PATCH 2/2] openvswitch: make auto-attach logic disable-able

Alexandru Ardelean ardeleanalex at gmail.com
Thu Jan 14 08:54:45 UTC 2016


On Thu, Jan 14, 2016 at 10:36 AM, Panu Matilainen <pmatilai at redhat.com>
wrote:

> On 01/13/2016 11:50 PM, Ben Pfaff wrote:
>
>> Ben Pfaff wrote:
>>
>>> How much does this commit trim from the binary size?
>>>
>>
>> Alexandru Ardelean wrote:
>>
>>> Roughly a 34k decrease in binary size, decrease being in libofproto and
>>> libopenvswitch libs
>>> Quite a small decrease, so more --disable-<feature> flags would be
>>> needed.
>>> My next thought would have been to go after making RSTP and STP
>>> disable-able.
>>>
>>
>> I am not sure that this is the best approach to follow first.  It
>> doesn't seem to me that we've actually written 500 kB of new code from
>> OVS 2.0 to OVS 2.5.  I'd be curious to find out where the size is coming
>> from.  I can think of a couple of approaches that one could take to find
>> that out.  One is to look at intermediate points (e.g. v2.1, v2.2, ...,
>> or bisected points in between them) and see if it is a steady growth or
>> whether there are big jumps, and if the latter, whether those jumps are
>> for good reason or not.  Another is to start from what we've got not,
>> look at the sizes of the various object files, and do something akin to
>> profiling but for code size: is the largest object file large for a
>> reason, or is there something unfortunate going on?
>>
>> I assume that OpenWRT builds optimize for size with -Os, is that true?
>>
>
> At least the the figures in the email look more like -O2, this is what I
> get for 2.5 branch on x86_64 after stripping:
>
> With -O2 (so default CFLAGS):
> -rwxr-xr-x. 1 pmatilai pmatilai  456640 Jan 14 09:28 libofproto.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai 1915832 Jan 14 09:28
> libopenvswitch.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai  155504 Jan 14 09:28 libovn.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai  119632 Jan 14 09:28 libovsdb.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai   26872 Jan 14 09:28 libsflow.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai  154960 Jan 14 09:28 libvtep.so.1.0.0
>
> With -Os:
> -rwxr-xr-x. 1 pmatilai pmatilai  399264 Jan 14 09:28 libofproto.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai 1674200 Jan 14 09:28
> libopenvswitch.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai  139120 Jan 14 09:28 libovn.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai  107344 Jan 14 09:28 libovsdb.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai   22768 Jan 14 09:28 libsflow.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai  142672 Jan 14 09:28 libvtep.so.1.0.0
>
> --enable-ndebug further reduces it to:
> -rwxr-xr-x. 1 pmatilai pmatilai  391072 Jan 14 10:04 libofproto.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai 1555384 Jan 14 10:04
> libopenvswitch.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai  106320 Jan 14 10:04 libovn.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai  103248 Jan 14 10:04 libovsdb.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai   22760 Jan 14 10:04 libsflow.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai   97616 Jan 14 10:04 libvtep.so.1.0.0
> [pmatilai at sopuli lib]$
>
> For comparison, 2.4 with the same options is:
> -rwxr-xr-x. 1 pmatilai pmatilai  370400 Jan 14 10:09 libofproto.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai 1423096 Jan 14 10:09
> libopenvswitch.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai  106320 Jan 14 10:09 libovn.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai  103216 Jan 14 10:09 libovsdb.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai   22760 Jan 14 10:09 libsflow.so.1.0.0
> -rwxr-xr-x. 1 pmatilai pmatilai   68784 Jan 14 10:09 libvtep.so.1.0.0
>
> OVS 2.3:
> -rwxr-xr-x. 1 pmatilai pmatilai  330424 Jan 14 10:27 libofproto-2.3.3.so
> -rwxr-xr-x. 1 pmatilai pmatilai 1413096 Jan 14 10:27
> libopenvswitch-2.3.3.so
> -rwxr-xr-x. 1 pmatilai pmatilai   98992 Jan 14 10:27 libovsdb-2.3.3.so
> -rwxr-xr-x. 1 pmatilai pmatilai   22680 Jan 14 10:27 libsflow-2.3.3.so
>
> OVS 2.2:
> -rwxr-xr-x. 1 pmatilai pmatilai  321368 Jan 14 10:26 libofproto-2.2.0.so
> -rwxr-xr-x. 1 pmatilai pmatilai 1374056 Jan 14 10:26
> libopenvswitch-2.2.0.so
> -rwxr-xr-x. 1 pmatilai pmatilai   98992 Jan 14 10:26 libovsdb-2.2.0.so
> -rwxr-xr-x. 1 pmatilai pmatilai   22680 Jan 14 10:26 libsflow-2.2.0.so
>
> OVS 2.1:
> -rwxr-xr-x. 1 pmatilai pmatilai  303864 Jan 14 10:29 libofproto-2.1.4.so
> -rwxr-xr-x. 1 pmatilai pmatilai 1325672 Jan 14 10:29
> libopenvswitch-2.1.4.so
> -rwxr-xr-x. 1 pmatilai pmatilai   98992 Jan 14 10:29 libovsdb-2.1.4.so
> -rwxr-xr-x. 1 pmatilai pmatilai   22680 Jan 14 10:29 libsflow-2.1.4.so
>
> 2.0 doesn't have libraries so its not directly comparable.
> Didn't look deeper into it but seems like fairly steady growth to me.
>
>         - Panu -
>

That was a quicker response than mine.
Thanks Panu.

@Ben, yes, default in OpenWRT is -Os and we also have --enable-ndebug
configure flag set.
And --disable-ssl flag set atm.
But, for packages, options & flags can be set individually and overridden.
OVS's flags and options in OpenWRT use as much defaults as possible, to
make it easier whenever cross-toolchains change (like switching libcs
between uClibc, musl & eGlibc)
The current numbers I provided were done against musl version 1.1.11
(OpenWRT's current default/preferred libc)

It might be worth it to go back and re-check some options & flags for OVS.
The thing is that OpenWRT has an entire build-system of it's own, so
surprises can occur.

But anyway, I'd like to conclude on this patch.
Let's drop it, and I'll make some time to see what can be done about the
current code in trunk and come up with cleaner proposals that help reduce
binary footprint.
As trunk is now, it's fine ; and I think I can find some ways to optimize
some code (and keep it readable of course).



More information about the dev mailing list