Date: Thu, 6 Aug 2015 20:24:16 -0700 From: Doug Hardie <bc979@lafn.org> To: Peter Jeremy <peter@rulingia.com>, FreeBSD Stable ML <stable@freebsd.org> Subject: Re: Swap Usage Message-ID: <64F9A45B-DB9D-4827-B5E8-0E15E395157A@lafn.org> In-Reply-To: <BCB80170-3E1E-4861-B159-CD52472FB475@lafn.org> References: <BCA67F7E-676A-4226-83A0-84229948895E@lafn.org> <20150730064444.GA88137@server.rulingia.com> <10F94D23-E58C-466E-ADCA-5E6670054BD7@lafn.org> <BCB80170-3E1E-4861-B159-CD52472FB475@lafn.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <stdio.h> #include <fcntl.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include <sys/mman.h> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?64F9A45B-DB9D-4827-B5E8-0E15E395157A>