Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 03 Nov 2012 12:38:39 -0600
From:      Ian Lepore <freebsd@damnhippie.dyndns.org>
To:        freebsd-hackers@freebsd.org, freebsd-embedded@freebsd.org
Subject:   watchdogd, jemalloc, and mlockall
Message-ID:  <1351967919.1120.102.camel@revolution.hippie.lan>

next in thread | raw e-mail | index | archive | help
In an attempt to un-hijack the thread about memory usage increase
between 6.4 and 9.x, I'm starting a new thread here related to my recent
discovery that watchdogd uses a lot more memory since it began using
mlockall(2).

I tried statically linking watchdogd and it made a small difference in
RSS, presumably because it doesn't wire down all of libc and libm.

 VSZ   RSS
10236 10164  Dynamic
 8624  8636  Static

Those numbers are from ps -u on an arm platform.  I just updated the PR
(bin/173332) with some procstat -v output comparing with/without
mlockall().

It appears that the bulk of the new RSS bloat comes from jemalloc
allocating vmspace in 8MB chunks.  With mlockall(MCL_FUTURE) in effect
that leads to wiring 8MB to satisfy what probably amounts to a few
hundred bytes of malloc'd memory.

It would probably also be a good idea to remove the floating point from
watchdogd to avoid wiring all of libm.  The floating point is used just
to turn the timeout-in-seconds into a power-of-two-nanoseconds value.
There's probably a reasonably efficient way to do that without calling
log(), considering that it only happens once at program startup.

-- Ian





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