i386/74327: [pmap] [patch] mlock() causes physical memory leakage

pluknet pluknet at gmail.com
Sat Feb 23 03:00:11 UTC 2008


The following reply was made to PR i386/74327; it has been noted by GNATS.

From: pluknet <pluknet at gmail.com>
To: bug-followup at freebsd.org, deniskv at mail.ru
Cc:  
Subject: Re: i386/74327: [pmap] [patch] mlock() causes physical memory leakage
Date: Sat, 23 Feb 2008 04:16:50 +0300

 I tried to reproduce on RELENG_[67] mlock()'ing 20 megs - without success.
 
 Test procedure (output from RELENG_7, same from _6):
 [root at notebook /tmp]# for i in 1 2 3 4 5; do ./a; done
 64414
 69534
 64414
 69534
 64414
 69534
 64414
 69534
 64414
 69534
 
 ---
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/sysctl.h>
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <strings.h>
 
 int
 main(void)
 {
 	u_int count;
 	size_t len = sizeof(u_int);
 	const size_t size = 20 * 1024 * 1024;
 	void *a;
 
 	a = malloc(size);
 	if (a == NULL)
 		perror("malloc");
 	bzero(a, size);
 	sysctlbyname("vm.stats.vm.v_wire_count", &count, &len,
 	    NULL, 0);
 	printf("%d\n", count);
 	if (mlock(a, size) == -1)
 		perror("mlock");
 	sysctlbyname("vm.stats.vm.v_wire_count", &count, &len,
 	    NULL, 0);
 	printf("%d\n", count);
 
 	exit(0);
 }
 ---


More information about the freebsd-i386 mailing list