2.6.16 hugetlbfs problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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, [email protected]

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux