mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
gh-44098: Release the GIL during mmap on Unix (GH-98146)
This seems pretty straightforward. The issue mentions other calls in mmapmodule that we could release the GIL on, but those are in methods where we'd need to be careful to ensure that something sensible happens if those are called concurrently. In prior art, note that #12073 released the GIL for munmap. In a toy benchmark, I see the speedup you'd expect from doing this. Automerge-Triggered-By: GH:gvanrossum
This commit is contained in:
parent
6a757da080
commit
f871e9a7bb
2 changed files with 4 additions and 3 deletions
|
|
@ -0,0 +1 @@
|
|||
Release the GIL when creating :class:`mmap.mmap` objects on Unix.
|
||||
|
|
@ -1318,9 +1318,9 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
|
|||
}
|
||||
}
|
||||
|
||||
m_obj->data = mmap(NULL, map_size,
|
||||
prot, flags,
|
||||
fd, offset);
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
m_obj->data = mmap(NULL, map_size, prot, flags, fd, offset);
|
||||
Py_END_ALLOW_THREADS
|
||||
|
||||
if (devzero != -1) {
|
||||
close(devzero);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue