2018-05-12 21:24 GMT+02:00 Chuck Silvers <c...@chuq.com>: > the problem with keeping the pages locked (ie. PG_BUSY) while accessing > the user address space is that it can lead to deadlock if the page
Meanwhile I've tested this scenario - wrote a test program to do mmap(2) for file, then calling write() using the memory from mmap as the buffer for write(2) for the same file offset. It actually caused the process to get SIGSEGV with new code, where the old code made write(2) just returned with EINVAL. I think this happens because fault resolution returns EINVAL when the page has PG_BUSY. Funny thing is that actually on Mac OS X that code actually does end up with deadlock, and unkillable process :D Maybe the SIGSEGV is actually acceptable behaviour? I don't think there would be valid reason to do mmap(2)/write(2) combination like that. Jaromir