All of lore.kernel.org
 help / color / mirror / Atom feed
* 2.6.16 hugetlbfs problem
@ 2006-03-22 22:10 Mark Rustad
  2006-03-22 22:13 ` David S. Miller
  0 siblings, 1 reply; 12+ messages in thread
From: Mark Rustad @ 2006-03-22 22:10 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Folks,

I seem to be having trouble using hugetlbfs with kernel 2.6.16. I  
have a small test program that worked with 2.6.16-rc5, but fails with  
2.6.16-rc6 or the release. The program is below. Given a path to a  
file on a hugetlbfs, it opens/creates the file, mmaps it and tries to  
access the first word. On 2.6.16-rc5, it works. On 2.6.16, it hangs  
page-faulting until it is killed.

#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>


int main(int argc, char *argv[])
{
	unsigned	len = 4 * 1024 * 1024;
	void	*vaddr = (void *)0x48000000;
	int	hfd;
	void	*p;
	int	*ip;

	if (!argc || !argv[1] || !argv[1][0]) {
		fprintf(stderr, "Missing argument\n");
		return 1;
	}
	hfd = open(argv[1], O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
	if (hfd < 0) {
		perror("open");
		return 1;
	}
	p = mmap(vaddr, len, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED,
		hfd, 0);
	if (p == MAP_FAILED) {
		perror("mmap");
		fprintf(stderr, "mmap failed at %p\n", vaddr);
		return 1;
	}
	ip = p;
	*ip = 0;	// This loops on page faults
	close(hfd);
	printf("Size %d in file %s\n", len, argv[1]);

	return 0;
}

Any ideas?

-- 
Mark Rustad, MRustad@mac.com


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2006-03-25  8:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-22 22:10 2.6.16 hugetlbfs problem Mark Rustad
2006-03-22 22:13 ` David S. Miller
2006-03-22 23:32   ` Mark Rustad
2006-03-23  5:43     ` Chen, Kenneth W
2006-03-23 15:36       ` Mark Rustad
2006-03-23 19:13         ` Mark Rustad
2006-03-24 17:52           ` 2.6.16 hugetlbfs problem - DEBUG_PAGEALLOC Mark Rustad
2006-03-25  1:24             ` Chen, Kenneth W
2006-03-25  1:47               ` David S. Miller
2006-03-25  2:53               ` Andrew Morton
2006-03-25  7:29                 ` Chen, Kenneth W
2006-03-25  8:15                   ` Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.