[lkml]   [2006]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject2.6.16 hugetlbfs problem

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) {
return 1;
p = mmap(vaddr, len, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED,
hfd, 0);
if (p == MAP_FAILED) {
fprintf(stderr, "mmap failed at %p\n", vaddr);
return 1;
ip = p;
*ip = 0; // This loops on page faults
printf("Size %d in file %s\n", len, argv[1]);

return 0;

Any ideas?

Mark Rustad,

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-03-22 23:12    [W:0.149 / U:1.500 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site