From owner-svn-src-all@FreeBSD.ORG Sat Jan 26 21:29:46 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5BAC05C0; Sat, 26 Jan 2013 21:29:46 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4CAD329; Sat, 26 Jan 2013 21:29:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0QLTkDg059134; Sat, 26 Jan 2013 21:29:46 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0QLTjdb059133; Sat, 26 Jan 2013 21:29:45 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201301262129.r0QLTjdb059133@svn.freebsd.org> From: Ian Lepore Date: Sat, 26 Jan 2013 21:29:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245949 - head/usr.sbin/watchdogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jan 2013 21:29:46 -0000 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; } }