diff options
author | Damien Zammit <damien@zamaudio.com> | 2021-12-26 22:38:56 +1100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2021-12-27 15:49:44 +0100 |
commit | 83ac2b3d67afc9895a80e813118569e2a73236ab (patch) | |
tree | 21eb952d95bb5b93dbf56974bee97deb91f5435f /rumpdisk | |
parent | 53059aedae2543d77bdd92e0a37c7ab108283c2f (diff) | |
download | hurd-83ac2b3d67afc9895a80e813118569e2a73236ab.tar.gz hurd-83ac2b3d67afc9895a80e813118569e2a73236ab.tar.bz2 hurd-83ac2b3d67afc9895a80e813118569e2a73236ab.zip |
pci-arbiter,rumpdisk: Lock all memory for swapping
This locks all memory in bootstrap processes so that
disk driver dependencies don't get swapped out.
Message-Id: <20211226113857.150525-5-damien@zamaudio.com>
Diffstat (limited to 'rumpdisk')
-rw-r--r-- | rumpdisk/main.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/rumpdisk/main.c b/rumpdisk/main.c index bafe0250..a1873c31 100644 --- a/rumpdisk/main.c +++ b/rumpdisk/main.c @@ -25,6 +25,7 @@ #include <error.h> #include <argp.h> #include <version.h> +#include <sys/mman.h> #include "libmachdev/machdev.h" #include "block-rump.h" @@ -113,6 +114,13 @@ main (int argc, char **argv) rump_register_block (); machdev_trivfs_init (argc, argv, bootstrap_resume_task, "rumpdisk", "/dev/rumpdisk", &bootstrap); + + /* Make sure we will not swap out, in case we drive the disk used for + swapping. */ + err = mlockall(MCL_CURRENT | MCL_FUTURE); + if (err) + error (1, errno, "cannot lock all memory"); + machdev_device_init (); err = pthread_create (&t, NULL, machdev_server, NULL); if (err) |