[issue36139] release GIL on mmap dealloc

Davide Rizzo report at bugs.python.org
Thu Feb 28 06:35:25 EST 2019


Davide Rizzo <sorcio at gmail.com> added the comment:

munmap() of private maps is usually pretty fast but not negligible (2 ms for 1GB). Shared maps are much slower. For some reason, shared maps explicitly backed by POSIX shared memory stand in between but are still pretty slow.

If someone cares about file-backed mmaps I can test those too. I thought this is already significant to justify releasing the GIL.


This is on Linux 4.4:


shared anon mmap 1048576 bytes
mmap time             6,393 ns
write time          449,062 ns
munmap time         100,205 ns
--
private anon mmap 1048576 bytes
mmap time             2,168 ns
write time          308,966 ns
munmap time          36,930 ns
--
posix shm + mmap 1048576 bytes
mmap time            13,299 ns
write time          369,305 ns
close time            1,545 ns
munmap time          26,759 ns
--

shared anon mmap 134217728 bytes
mmap time             4,641 ns
write time       64,508,536 ns
munmap time      13,592,556 ns
--
private anon mmap 134217728 bytes
mmap time             6,116 ns
write time       25,402,084 ns
munmap time         388,976 ns
--
posix shm + mmap 134217728 bytes
mmap time            29,034 ns
write time       66,826,645 ns
close time            3,707 ns
munmap time       3,475,977 ns
--

shared anon mmap 1073741824 bytes
mmap time            11,127 ns
write time      508,227,373 ns
munmap time      94,885,306 ns
--
private anon mmap 1073741824 bytes
mmap time             7,133 ns
write time      199,933,903 ns
munmap time       2,361,036 ns
--
posix shm + mmap 1073741824 bytes
mmap time            24,868 ns
write time      527,566,819 ns
close time            4,015 ns
munmap time      21,179,674 ns
--

----------
Added file: https://bugs.python.org/file48177/unmap.c

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36139>
_______________________________________


More information about the Python-bugs-list mailing list