-
Notifications
You must be signed in to change notification settings - Fork 35
Add support for MAP_SHARED for Linux only #429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the main purpose of this PR to enable shared memory for forked processes?
I removed the SHARED flag a while back because it was not clear how to allow other processes to use this memory (#236) other than by using fork. I think this requires more research and we should probably consider using IPC (@vinser52 did we have any discussion about this on any of the issues?)
Also, @ldorau please extend existing bind
tests to test MAP_SHARED as well. I'm not sure whether hwloc_set_area_membind will work with MAP_SHARED. According to the documentation of mbind: The specified policy will be ignored for any MAP_SHARED mappings in the specified memory range. Rather the pages will be allocated according to the memory policy of the thread that caused the page to be allocated.
@igchor this PR is a part of the requirements for CAL library |
How is this shared region supposed to be used? As Igor said, one of the use cases for shared memory on a host is IPC. Regarding CAL, do we already have exact requirements? |
I asked CAL team about that. I thought this should be as simple as adding MAP_SHARED flag but now I think it should be changed to a draft version until we get the requirements. |
de5544d
to
84666de
Compare
9f8f85f
to
7aaa1f4
Compare
871035e
to
493f038
Compare
@vinser52 please re-review |
src/provider/provider_os_memory.c
Outdated
int fd; // file descriptor for memory mapping | ||
size_t size_fd; // size of file used for memory mapping | ||
size_t max_size_fd; // maximum size of file used for memory mapping | ||
// A critnib map storing (ptr, fd_offset + 1) pairs (+ 1 to be able to store fd_offset == 0). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we cannot store fd_offset == 0
in the map?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
critnib_get()
returns value or NULL, so a value cannot equal 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, got it.
Could you please explicitly mention this in the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Done
950345c
to
2e9b682
Compare
2e9b682
to
6445425
Compare
51b272c
to
d526d7f
Compare
df7ef79
to
c510e59
Compare
Add support for MAP_SHARED to OS memory provider for Linux only and for the UMF_NUMA_MODE_DEFAULT only. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Add an IPC shared memory test using only the OS memory provider API (not using the API from ipc.h). Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
c510e59
to
aeb0c72
Compare
Description
MAP_SHARED
to OS memory providerMAP_SHARED
to the proxy libraryipc_os_prov
) using only the OS memory provider API (not using the API fromipc.h
).Checklist