bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/5] pci-arbiter,rumpdisk: Lock all memory for swapping


From: Samuel Thibault
Subject: Re: [PATCH 4/5] pci-arbiter,rumpdisk: Lock all memory for swapping
Date: Mon, 27 Dec 2021 15:49:51 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Damien Zammit, le dim. 26 déc. 2021 22:38:56 +1100, a ecrit:
> This locks all memory in bootstrap processes so that
> disk driver dependencies don't get swapped out.

Applied, thanks!

> ---
>  pci-arbiter/main.c | 9 +++++++++
>  rumpdisk/main.c    | 8 ++++++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/pci-arbiter/main.c b/pci-arbiter/main.c
> index 510e7dbc..602a545c 100644
> --- a/pci-arbiter/main.c
> +++ b/pci-arbiter/main.c
> @@ -203,8 +203,17 @@ main (int argc, char **argv)
>  
>    if (next_task != MACH_PORT_NULL)
>      {
> +      /* We are a bootstrap process */
> +
>        machdev_register (&pci_arbiter_emulation_ops);
>        machdev_trivfs_init (argc, argv, next_task, "pci", NULL /* 
> _SERVERS_BUS "pci" */, &bootstrap);
> +
> +      /* Make sure we will not swap out, in case we are needed for swapping
> +         back in.  */
> +      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)
> 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)
> -- 
> 2.33.1
> 
> 

-- 
Samuel
«Tiens, quand j'aurai un peu de temps et une partition libre, je crois
 que je vais essayer de remplacer mes scripts de démarrage par des
 programmes Windows lancés via Wine et binfmt_misc :-)»
-+- AGV in Guide du linuxien pervers - "J'sais pas quoi faire... (air connu)"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]