From owner-freebsd-stable@freebsd.org Fri Aug 7 03:24:26 2015 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DED599B5B9F for ; Fri, 7 Aug 2015 03:24:25 +0000 (UTC) (envelope-from bc979@lafn.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id C81091E6C for ; Fri, 7 Aug 2015 03:24:25 +0000 (UTC) (envelope-from bc979@lafn.org) Received: by mailman.ysv.freebsd.org (Postfix) id C4FD69B5B9C; Fri, 7 Aug 2015 03:24:25 +0000 (UTC) Delivered-To: stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C49689B5B9B for ; Fri, 7 Aug 2015 03:24:25 +0000 (UTC) (envelope-from bc979@lafn.org) Received: from zoom.lafn.org (zoom.lafn.org [108.92.93.123]) by mx1.freebsd.org (Postfix) with ESMTP id 87CE71E67 for ; Fri, 7 Aug 2015 03:24:25 +0000 (UTC) (envelope-from bc979@lafn.org) Received: from mbook.home (pool-71-178-226-198.washdc.fios.verizon.net [71.178.226.198]) (authenticated bits=0) by zoom.lafn.org (8.14.7/8.14.9) with ESMTP id t773NHaT005634 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 6 Aug 2015 20:24:17 -0700 (PDT) (envelope-from bc979@lafn.org) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Subject: Re: Swap Usage From: Doug Hardie In-Reply-To: Date: Thu, 6 Aug 2015 20:24:16 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <64F9A45B-DB9D-4827-B5E8-0E15E395157A@lafn.org> References: <20150730064444.GA88137@server.rulingia.com> <10F94D23-E58C-466E-ADCA-5E6670054BD7@lafn.org> To: Peter Jeremy , FreeBSD Stable ML X-Mailer: Apple Mail (2.2102) X-Virus-Scanned: clamav-milter 0.98 at zoom.lafn.org X-Virus-Status: Clean X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2015 03:24:26 -0000 Some more testing indicates that the problem is most likely in close, = not mmap. I modified the program to the following: zool# more test.c #include #include #include #include #include #include int main (int argc, char *argv[]) { int rc, pid, fd; char *cp; char cmd[1024]; pid =3D getpid (); sprintf (cmd, "procstat -v %d | grep df", pid); fflush (stdout); rc =3D system (cmd); fflush (stdout); printf ("----------------------------------\n"); fd =3D open ("./test.c", O_RDWR); fflush (stdout); rc =3D system (cmd); fflush (stdout); printf ("----------------------------------\n"); close (fd); fflush (stdout); rc =3D system (cmd); fflush (stdout); } The output is: zool# ./test 85860 0x8049000 0x804a000 rw- 1 0 1 0 CN-- df=20 85860 0x2805f000 0x28069000 rw- 10 0 1 0 C--- df=20 85860 0x28186000 0x281ad000 rw- 13 0 1 0 CN-- df=20 85860 0xbfbdf000 0xbfbff000 rwx 3 0 1 0 C--D df=20 ---------------------------------- 85860 0x8049000 0x804a000 rw- 1 0 1 0 CN-- df=20 85860 0x804a000 0x8400000 rw- 1 0 1 0 CN-- df=20 85860 0x2805f000 0x28069000 rw- 10 0 1 0 CN-- df=20 85860 0x28186000 0x281ad000 rw- 14 0 1 0 CN-- df=20 85860 0x28400000 0x28800000 rw- 6 0 1 0 CN-- df=20 85860 0xbfbdf000 0xbfbff000 rwx 3 0 1 0 C--D df=20 ---------------------------------- 85860 0x8049000 0x804a000 rw- 1 0 1 0 CN-- df=20 85860 0x804a000 0x8400000 rw- 1 0 1 0 CN-- df=20 85860 0x2805f000 0x28069000 rw- 10 0 1 0 CN-- df=20 85860 0x28186000 0x281ad000 rw- 14 0 1 0 CN-- df=20 85860 0x28400000 0x28800000 rw- 6 0 1 0 CN-- df=20 85860 0xbfbdf000 0xbfbff000 rwx 3 0 1 0 C--D df=20 Open creates 2 memory allocations, one in low memory and one in high. = Close does not remove them. Somewhere in the source I found a note that = said that close on files didn=E2=80=99t require any action. However, = those two memory allocations do need to get freed. =20