remap_file_pages doesn't like MAP_ANONYMOUS (but used to?)
From: Kenny Simpson
Date: Thu Mar 17 2011 - 02:01:55 EST
In older kernels (2.6.15-2.6.18?) I was able to make an anonymous mapping and remap part of it back over itself to create a circular buffer:
p = mmap(0, sz, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0)
remap_file_pages(p + sz/2, sz/2, 0/*prot*/, 0/*offset*/, 0/*flags*/)
I find the same method fails with EINVAL on the remap_file_pages call in 2.6.35/38. Making a dummy file or shared memory object works, but seems a bit more messy.
Why drop support for ANONYMOUS? Is there another way to get the same effect?
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/