[CRIU] [PATCHv2 0/9] Large pages support for aarch64/ppc64

Dmitry Safonov 0x7f454c46 at gmail.com
Fri Mar 30 02:51:43 MSK 2018


2018-03-29 15:20 GMT+01:00 Mike Rapoport <rppt at linux.vnet.ibm.com>:
> There's one more [PAGE_SIZE] array in mem.c:
>
> From 0a0a1418900677820a5396b9f58352368122a784 Mon Sep 17 00:00:00 2001
> From: Mike Rapoport <rppt at linux.vnet.ibm.com>
> Date: Thu, 29 Mar 2018 17:13:26 +0300
> Subject: [CRIU][PATCH 5.5/9] criu/mem: use alloca() to allocate the buffer for
>  page-read
>
> For variable PAGE_SIZE using alloca() is better than variable length array
> and the actual effect will be the same.
>
> Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
> ---
>  criu/mem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/criu/mem.c b/criu/mem.c
> index 9ee5029..14b22b5 100644
> --- a/criu/mem.c
> +++ b/criu/mem.c
> @@ -907,6 +907,7 @@ static int restore_priv_vma_content(struct pstree_item *t, struct page_read *pr)
>         int ret = 0;
>         struct list_head *vmas = &rsti(t)->vmas.h;
>         struct list_head *vma_io = &rsti(t)->vma_io;
> +       unsigned char *buf = alloca(PAGE_SIZE);
>
>         unsigned int nr_restored = 0;
>         unsigned int nr_shared = 0;
> @@ -948,7 +949,6 @@ static int restore_priv_vma_content(struct pstree_item *t, struct page_read *pr)
>                 }
>
>                 for (i = 0; i < nr_pages; i++) {
> -                       unsigned char buf[PAGE_SIZE];
>                         void *p;
>
>                         /*
> --
> 2.7.4

Oh, good, thank you!
Ugh, but... I wonder, how did that compile with dynamic PAGE_SIZE?
Need to check that..

-- 
             Dmitry


More information about the CRIU mailing list