]> git.ipfire.org Git - thirdparty/gcc.git/commit
libgomp: pinned memory
authorAndrew Stubbs <ams@codesourcery.com>
Fri, 11 Mar 2022 12:12:39 +0000 (12:12 +0000)
committerHafiz Abid Qadeer <abidh@codesourcery.com>
Fri, 11 Mar 2022 23:03:58 +0000 (23:03 +0000)
commit4356385e58533f4973098b14a8ebe5be21b9e031
tree76160ee45a9538f15a6560d4262ed9dd18f6b7c6
parent28ea857df2ef384627b3bc803c8a5a4ce037e6b2
libgomp: pinned memory

Implement the OpenMP pinned memory trait on Linux hosts using the mlock
syscall.  Pinned allocations are performed using mmap, not malloc, to ensure
that they can be unpinned safely when freed.

Backport of a patch posted at
https://gcc.gnu.org/pipermail/gcc-patches/2022-January/588360.html

libgomp/ChangeLog:
* allocator.c (MEMSPACE_ALLOC): Add PIN.
(MEMSPACE_CALLOC): Add PIN.
(MEMSPACE_REALLOC): Add PIN.
(MEMSPACE_FREE): Add PIN.
(xmlock): New function.
(omp_init_allocator): Don't disallow the pinned trait.
(omp_aligned_alloc): Add pinning to all MEMSPACE_* calls.
(omp_aligned_calloc): Likewise.
(omp_realloc): Likewise.
(omp_free): Likewise.
* config/linux/allocator.c: New file.
* config/nvptx/allocator.c (MEMSPACE_ALLOC): Add PIN.
(MEMSPACE_CALLOC): Add PIN.
(MEMSPACE_REALLOC): Add PIN.
(MEMSPACE_FREE): Add PIN.
* testsuite/libgomp.c/alloc-pinned-1.c: New test.
* testsuite/libgomp.c/alloc-pinned-2.c: New test.
* testsuite/libgomp.c/alloc-pinned-3.c: New test.
* testsuite/libgomp.c/alloc-pinned-4.c: New test.
libgomp/ChangeLog.omp
libgomp/allocator.c
libgomp/config/linux/allocator.c [new file with mode: 0644]
libgomp/config/nvptx/allocator.c
libgomp/testsuite/libgomp.c/alloc-pinned-1.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/alloc-pinned-2.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/alloc-pinned-3.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/alloc-pinned-4.c [new file with mode: 0644]