Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jul 2014 14:53:31 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        Adrian Chadd <adrian@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, Baptiste Daroussin <bapt@freebsd.org>, Pedro Giffuni <pfg@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r268461 - in head: . gnu/lib/libreadline gnu/lib/libreadline/history gnu/lib/libreadline/readline gnu/lib/libreadline/readline/doc gnu/usr.bin/gdb gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/gd...
Message-ID:  <20140710115331.GN93733@kib.kiev.ua>
In-Reply-To: <20140710153824.S985@besplex.bde.org>
References:  <201407091552.s69FqUon070685@svn.freebsd.org> <53BD68E4.1070706@freebsd.org> <CAJ-VmonsZzATyWC9g-pxaQ_qDSvOh-jbiWhY=92vgmovqvn-BQ@mail.gmail.com> <20140709172305.GD56040@ivaldir.etoilebsd.net> <CAJ-Vmo=kLQ27km1hRcwFsinmBMA=UVWcZyw5gBLJ-V1UvQPuOw@mail.gmail.com> <20140709182745.GD93733@kib.kiev.ua> <20140710153824.S985@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--TBfMz8Gxdi+pF8p5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Jul 10, 2014 at 03:57:18PM +1000, Bruce Evans wrote:
> On Wed, 9 Jul 2014, Konstantin Belousov wrote:
>=20
> > On Wed, Jul 09, 2014 at 11:05:29AM -0700, Adrian Chadd wrote:
> >> On 9 July 2014 10:23, Baptiste Daroussin <bapt@freebsd.org> wrote:
> >>> On Wed, Jul 09, 2014 at 10:12:27AM -0700, Adrian Chadd wrote:
> >>>> Hi,
> >>>>
> >>>> By doing this you're actually making more work for the really embedd=
ed
> >>>> people who have size constraints on things.
> >>>>
> >>>> I dislike privatelib but it at least allows for code sharing where
> >>>> before people would just statically link things into binaries.
> >>>
> >>> do you install gdb on your embedded environnement? because that is th=
e only
> >>> user of libreadline.
> >>
> >> See below.
> >>>>
> >>>> I've had to actively undo this kind of dumb before in order to get
> >>>> things to fit on very small flash root filesystems.
> >>>>
> >>>> Shared libraries are good. Please stop assuming we have lots of disk
> >>>> space and RAM to have duplicates of things floating around.
>=20
> Shared libraries are not good.  They save a little disk space but cost an
> enormous amount of RAM.  E.g.:
>=20
> FreeBSD-~5.2 i386, statically linked:
>    PID USERNAME  THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
>   1101 bde         1  76    0  1392K   780K RUN      0:00  0.00% top
>=20
> FreeBSD-11 i386, dynamically linked:
>    PID USERNAME       THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU=
 COMMAN
> 25085 bde              1  21    0 11260K  2432K STOP    4   0:00   0.00% =
top
>=20
> Here dynamic linkage and perhaps other bloat takes 3 times as much RAM (R=
ES)
> and 8 times as much virtual memory (SIZE).  For long-running programs, ev=
en
> more RAM (or swap to the disk that you apparently don't have on embedded
> systems), it is likely for more of the shared library virtual memory to
> be written to so that it becomes physical.  This might explain the even
> larger RAM uses in the following:
>=20
> FreeBSD-~5.2 i386, statically linked:
>    PID USERNAME  THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
>    681 root        1  76    0  1676K  1132K select   0:00  0.00% sshd
>    659 root        1  44   r0   848K   536K select   0:00  0.00% ntpd
>    688 root        1  76    0  2084K  1796K select   0:00  0.00% sendmail
>=20
> FreeBSD-11 i386, dynamically linked:
>    PID USERNAME       THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU=
 COMMAN
> 25072 bde              1  20    0 17836K  6556K select  1   0:00   0.00% =
sshd
>    693 root             1  20    0 12356K  4168K select  4   0:02   0.00%=
 ntpd
>    744 root             1  20    0 12868K  4752K select  0   0:01   0.00%=
 sendma
>=20
> Here dynamic sshd takes almost 6 times as much RAM; dynamic ntpd almost
> 8 times as much, but dymamic sendmail takes less than 3 times as much.
Libc tends to get paged in completely, since it is used by different
processes.  That said, RES does not distinguish between shared resident
pages and private pages, which makes this comparision less interesting
than it sounds.

>=20
> The output also shows misformatting of the USERNAME column in newer versi=
ons
> of FreeBSD (lots of unused whitespace to kill the command name non-whites=
pace).
>=20
> However, I would like the option to link any library shared, in case I
> want to optimize disk space at the cost of RAM and runtime.
>=20
> > What Baptiste did is the only correct way to handle the ABI and API
> > un-stability issues with the third-party libraries.  The change is
> > good if only for this sole reason.  Private libraries still conflict
> > with the same library installed by other means, in the single process
> > image.
>=20
> Works even better for libc :-).  Static libraries also insulate from
> the latest bloat and security holes.  There main problem is that they
> give old security holes instead.

No, the ABI of libc matters, the interfaces of the internal libs are
volatile, since the base system is supposed to be upgraded as the
whole, and anything which depends on internal lib is upgraded.  Out
of base system, nothing can use internal lib.  In other words, internal
libraries are invisible outside the base system, even outside the
build time of the base system.

--TBfMz8Gxdi+pF8p5
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJTvn67AAoJEJDCuSvBvK1B3VMP/2MY4q1nhpc/ENqhM9JHZ+Uu
t0NB+ESxZDiGZ61+oalwGL+oQTHwdcHG+SQGM21X/xx+HoAxoRh4gY2k6eWSW6cs
iebwHdaiACTv3Uxc6KDrfY8GgKPGazIpzRl7wiaEfhEr5Z4iAC3v17x+fQpd8/A/
FUx1hZeO7Oc8jSwWe0jAccr7QVJL8N2XAgXu3FDuJMfVXyHOXBUur2b7o7IHpkfv
r2U49tkd7maFUa62EoIk1kYPyK44VwTagBocdDPGo3YcAGVB+dKhm//+vtZjWGbD
fmz2z4amHjegWAUMG8Zli+Rw/wKUlqdySjIy7Mydb/nQHBSoNOjaj4PdeflRs7NX
sid+abTcYO+ZMCXSBWK/RfPfuN2aHKbDB7BCs89Qn8sPKUlcn3/iukgVy6KedBzW
d1LY2YMgvZJ8mfXDJaD0gFRs30f/n7xpIJT5ATHrae7Rve5iUNdn6sV9HEnHeb1M
2BIEYyqChlAUJ67vR1TcG7mWWWNNadhz7KTz7ucOVhErSk9J3EyccKucJ5Wcm+pM
QPntHNxX/iDF09twOBTj9LSiEA9QYe9e0Lka1VHcU6s229daD59ZI2SHtP1JT2wT
Ftnp1nfyZ3KbDVuCC4NhAkqPqtcUWJ52xXLfUp7+DHc0Phl4oSIp547kVjKvsyUz
PyFENKcZNzBjmtf4UluG
=gzsp
-----END PGP SIGNATURE-----

--TBfMz8Gxdi+pF8p5--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140710115331.GN93733>