Date: Sat, 26 Jan 2013 21:30:02 GMT From: dfilter@FreeBSD.ORG (dfilter service) To: freebsd-bugs@FreeBSD.org Subject: Re: bin/173332: commit references a PR Message-ID: <201301262130.r0QLU2hi050835@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/173332; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: bin/173332: commit references a PR Date: Sat, 26 Jan 2013 21:29:54 +0000 (UTC) Author: ian Date: Sat Jan 26 21:29:45 2013 New Revision: 245949 URL: http://svnweb.freebsd.org/changeset/base/245949 Log: Reduce watchdogd's memory footprint when running daemonized. This uses the recently-added jemalloc(3) feature of setting the lg_chunk tuning option to zero to request that memory be allocated in the smallest chunks possible. Without this option, the default is to initally map 8MB, and then the mlockall() call wires that entire allocation even though the program only uses a few Kbytes of it at runtime. PR: bin/173332 Approved by: cognet (mentor) Modified: head/usr.sbin/watchdogd/watchdogd.c Modified: head/usr.sbin/watchdogd/watchdogd.c ============================================================================== --- head/usr.sbin/watchdogd/watchdogd.c Sat Jan 26 20:16:58 2013 (r245948) +++ head/usr.sbin/watchdogd/watchdogd.c Sat Jan 26 21:29:45 2013 (r245949) @@ -71,6 +71,14 @@ static int nap = 1; static char *test_cmd = NULL; /* + * Ask malloc() to map minimum-sized chunks of virtual address space at a time, + * so that mlockall() won't needlessly wire megabytes of unused memory into the + * process. This must be done using the malloc_conf string so that it gets set + * up before the first allocation, which happens before entry to main(). + */ +const char * malloc_conf = "lg_chunk:0"; + +/* * Periodically pat the watchdog, preventing it from firing. */ int @@ -188,7 +196,7 @@ watchdog_loop(void) if (watchdog_onoff(0) == 0) { end_program = 2; } else { - warnx("Could not stop the watchdog, not exiting"); + warnx("Could not stop the watchdog, not exitting"); end_program = 0; } } _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301262130.r0QLU2hi050835>