Messages in this thread | | | Date | Thu, 11 Dec 2003 19:59:41 +0100 | From | Lutz Vieweg <> | Subject | mlock() "bogus check" (locked > num_physpages/2) _does_ hurt! |
| |
Hi everyone,
in kernel 2.4.23, file mm/mlock.c, line 215, there's the following piece of code:
/* we may lock at most half of physical memory... */ /* (this check is pretty bogus, but doesn't hurt) */ if (locked > num_physpages/2) goto out;
Obviously, the author already realized this check is bogus, but the assumption that it doesn't hurt is very wrong... at least for me: I'm writing a server application that uses much more virtual memory than there's physical memory (and on 64bit systems, there can be a lot more virtual memory!). The application needs to access only a small fraction of the memory used during normal operation, the rest of the virtual memory used is used for (slowly) rebuilding indicies in the background. So it is completely ok for me that most of the applications memory is swapped out, and to make sure that response times are low even after much of the memory is on disk, I use mlock() to lock the interesting pages in memory.
And yes, I would very much like to use more than half of the physical memory for that purpose!
Is there any good reason to keep this check in the 2.4 kernel sources? Is there any good reason to not use a different default value for the RLIMIT_MEMLOCK value (which is currently 0xffffffffffffffff), instead?
It's good to know the check is not present in the 2.6 sources, but I would like to get rid of it in 2.4, too...
Regards,
Lutz Vieweg
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |