xpmem: fix mapping of attachment and segment

* Mapping attached part of segment is done at attach time instead of
  make time to work with runtimes (e.g. OpenMPI) xpmem_make-ing the
  entire user-space
* Mapping attached part of segment at attach time can be turned off by
  specifying xpmem_remote_on_demand in kernel argument
* Mapping attachment chooses appropriate page-sizes, i.e., largest
  allowed by memory range and segment page boundary

Fixes: a8696d8 "xpmem: Support large page attachment"
Change-Id: I44663865204036520e5f62fe22b9134ee4629f9b
This commit is contained in:
Masamichi Takagi
2020-05-12 13:17:46 +09:00
parent d370e9241f
commit a5fcc91656
43 changed files with 2876 additions and 285 deletions

View File

@@ -110,6 +110,7 @@ int main(int argc, char **argv)
addr.apid = apid;
addr.offset = 0;
printf("child: attaching...\n");
attach = xpmem_attach(addr, map_size + (extr_size * 2), NULL);
CHKANDJUMP(attach == (void *)-1, EXIT_FAILURE,
@@ -151,6 +152,7 @@ int main(int argc, char **argv)
CHKANDJUMP(shm == (void *)-1, EXIT_FAILURE,
"shmat failed: %s\n", strerror(errno));
printf("parent: making...\n");
segid = xpmem_make(mem_1, map_size + (extr_size * 2),
XPMEM_PERMIT_MODE, (void *)0666);
CHKANDJUMP(segid == -1, EXIT_FAILURE,
@@ -158,6 +160,7 @@ int main(int argc, char **argv)
*(xpmem_segid_t *)shm = segid;
printf("parent: waiting...\n");
ret = waitpid(pid, &status, 0);
printf("child exited\n");
CHKANDJUMP(ret == -1, EXIT_FAILURE, "waitpid failed\n");