checkpoint: various mm-related bits
cover checkpoint: various mm-related bits
Hi Oren,
Here is the hugetlb code rebased to latest ckpt-v22-dev, along with support for BSR device mappings and a minor fix or two.
Nathan Lynch (11):
checkpoint: fix leak in VMA restore error path
checkpoint: check actual array size before dereferencing
checkpoint: reformat CKPT_VMA_NOT_SUPPORTED
checkpoint: introduce device vma type
checkpoint: allow VM_{IO,RESERVED,PFNMAP} mappings
checkpoint: enable c/r for bsr driver checkpoint/ipc: allow shmat callers to specify ipc namespace checkpoint/restart of anonymous hugetlb mappings hugetlbfs checkpoint/restart hooks checkpoint/restart of SysV SHM_HUGETLB regions remove VM_HUGETLB from CKPT_VMA_NOT_SUPPORTED
drivers/char/bsr.c | 13 ++ fs/hugetlbfs/inode.c | 24 ++++- include/linux/checkpoint.h | 17 ++- include/linux/checkpoint_hdr.h | 18 +++ include/linux/hugetlb.h | 11 ++ include/linux/shm.h | 8 +- ipc/checkpoint_shm.c | 154 ++++++++++++++++++++++-- ipc/shm.c | 18 ++-- mm/checkpoint.c | 55 ++++++++- mm/hugetlb.c | 257 ++++++++++++++++++++++++++++++++++++++++ 10 files changed, 543 insertions(+), 32 deletions(-)
Signature · 1 line
1.7.2.2
A message that is not in the archive (sent off-list or not yet received): 1287601006-13794-1-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
PATCH 1/11 checkpoint: fix leak in VMA restore error path
If the vma record contains unsupported flags restore_vma() returns -ENOSYS without releasing the record.
--- mm/checkpoint.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
mm/checkpoint.c +2 -1
@@ -1209,8 +1209,9 @@ static int restore_vma(struct ckpt_ctx *ctx, struct mm_struct *mm) goto out;if (h->vma_type >=CKPT_VMA_MAX ) goto out; + ret = -ENOSYS ;if (h->vm_flags &CKPT_VMA_NOT_SUPPORTED ) -return -ENOSYS ; + goto out; ops = &restore_vma_ops[h->vma_type];
Signature · 1 line
1.7.2.2
A message that is not in the archive (sent off-list or not yet received): 1287601006-13794-2-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
Matt Helsley
Reviewed-byRe: [PATCH 01/11] checkpoint: fix leak in VMA restore error path
Quoted 4 lines · Nathan Lynch
If the vma record contains unsupported flags
restore_vma()returns-ENOSYSwithout releasing the record.Signed-off-by Nathan Lynch <[email protected]>
Quoted 26 lines
--- mm/checkpoint.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)mm/checkpoint.c +2
-1@@ -1209,8 +1209,9 @@ static int restore_vma(struct ckpt_ctx *ctx, struct mm_struct *mm) goto out;if (h->vma_type >=CKPT_VMA_MAX ) goto out; + ret = -ENOSYS ;if (h->vm_flags &CKPT_VMA_NOT_SUPPORTED ) -return -ENOSYS ; + goto out; ops = &restore_vma_ops[h->vma_type];Signature · 6 lines
1.7.2.2 _______________________________________________ Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org https://lists.linux-foundation.org/mailman/listinfo/containers
PATCH 2/11 checkpoint: check actual array size before dereferencing
In reply to a message not in the archiveThe restore_vma_ops table is indexed by vma type (enum vma_type in checkpoint_hdr.h). We check the incoming VMA's type against CKPT_VMA_MAX (which happens to be the size of the table), but it seems more to-the-point to compare the type against the actual size of the array.
--- mm/checkpoint.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
mm/checkpoint.c +1 -1
@@ -1207,7 +1207,7 @@ static int restore_vma(struct ckpt_ctx *ctx, struct mm_struct *mm) goto out;if (h->vma_objref <0 || h->ino_objref <0 ) goto out; -if (h->vma_type >=CKPT_VMA_MAX ) +if (h->vma_type >=ARRAY_SIZE (restore_vma_ops)) goto out; ret = -ENOSYS ;if (h->vm_flags &CKPT_VMA_NOT_SUPPORTED )
Signature · 1 line
1.7.2.2
A message that is not in the archive (sent off-list or not yet received): 1287601006-13794-3-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
Matt Helsley
Reviewed-byRe: [PATCH 02/11] checkpoint: check actual array size before dereferencing
Quoted 5 lines · Nathan Lynch
The
restore_vma_opstable is indexed by vma type (enumvma_typeincheckpoint_hdr.h). We check the incoming VMA's type againstCKPT_VMA_MAX(which happens to be the size of the table), but it seems more to-the-point to compare the type against the actual size of the array.
I don't know about "more to-the-point" but I think it's a clear improvement from a code maintenance perspective.
Quoted 11 lines
Signed-off-by Nathan Lynch <[email protected]>--- mm/checkpoint.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)mm/checkpoint.c +0
-0
mm/checkpoint.c static int restore_vma(struct ckpt_ctx *ctx, struct mm_struct *mm) · line 1211
Quoted 6 lines
mm/checkpoint.c +1
-1@@ -1207,7 +1207,7 @@ static int restore_vma(struct ckpt_ctx *ctx, struct mm_struct *mm) goto out;if (h->vma_objref <0 || h->ino_objref <0 ) goto out; -if (h->vma_type >=CKPT_VMA_MAX ) +if (h->vma_type >=ARRAY_SIZE (restore_vma_ops)) goto out;
Perhaps we should also add:
BUILD_BUG_ON(CKPT_VMA_MAX != ARRAY_SIZE(restore_vma_ops));
somewhere? Though I don't think that addition should delay applying this series.
Quoted 9 lines
mm/checkpoint.c +0
-0ret = -ENOSYS ;if (h->vm_flags &CKPT_VMA_NOT_SUPPORTED )Signature · 6 lines
1.7.2.2 _______________________________________________ Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org https://lists.linux-foundation.org/mailman/listinfo/containers
PATCH 3/11 checkpoint: reformat CKPT_VMA_NOT_SUPPORTED
In reply to a message not in the archiveRemove duplicate VM_HUGETLB and VM_NONLINEAR; place each flag on its own line and alphabetize the list. This will make future modifications to CKPT_VMA_NOT_SUPPORTED easier to review.
--- include/linux/checkpoint.h | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)
include/linux/checkpoint.h +11 -4
@@ -309,10 +309,17 @@ extern int checkpoint_memory_contents(struct ckpt_ctx *ctx,extern int restore_memory_contents (struct ckpt_ctx *ctx,struct inode *inode); -#define CKPT_VMA_NOT_SUPPORTED \ - (VM_IO | VM_HUGETLB | VM_NONLINEAR | VM_PFNMAP | \ - VM_RESERVED | VM_HUGETLB | VM_NONLINEAR | \ - VM_MAPPED_COPY | VM_INSERTPAGE | VM_MIXEDMAP | VM_SAO) +#define CKPT_VMA_NOT_SUPPORTED ( \ + VM_HUGETLB | \ + VM_INSERTPAGE | \ + VM_IO | \ + VM_MAPPED_COPY | \ + VM_MIXEDMAP | \ + VM_NONLINEAR | \ + VM_PFNMAP | \ + VM_RESERVED | \ + VM_SAO | \ + 0)/* signals */ extern int checkpoint_obj_sighand (struct ckpt_ctx *ctx,struct task_struct *t);
Signature · 1 line
1.7.2.2
A message that is not in the archive (sent off-list or not yet received): 1287601006-13794-4-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
Matt Helsley
Reviewed-byRe: [PATCH 03/11] checkpoint: reformat CKPT_VMA_NOT_SUPPORTED
Quoted 5 lines · Nathan Lynch
Remove duplicate
VM_HUGETLBandVM_NONLINEAR; place each flag on its own line and alphabetize the list. This will make future modifications toCKPT_VMA_NOT_SUPPORTEDeasier to review.Signed-off-by Nathan Lynch <[email protected]>
Quoted 37 lines
--- include/linux/checkpoint.h | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)include/linux/checkpoint.h +11
-4@@ -309,10 +309,17 @@ extern int checkpoint_memory_contents(struct ckpt_ctx *ctx,extern int restore_memory_contents (struct ckpt_ctx *ctx,struct inode *inode); -#define CKPT_VMA_NOT_SUPPORTED \ - (VM_IO | VM_HUGETLB | VM_NONLINEAR | VM_PFNMAP | \ - VM_RESERVED | VM_HUGETLB | VM_NONLINEAR | \ - VM_MAPPED_COPY | VM_INSERTPAGE | VM_MIXEDMAP | VM_SAO) +#define CKPT_VMA_NOT_SUPPORTED ( \ + VM_HUGETLB | \ + VM_INSERTPAGE | \ + VM_IO | \ + VM_MAPPED_COPY | \ + VM_MIXEDMAP | \ + VM_NONLINEAR | \ + VM_PFNMAP | \ + VM_RESERVED | \ + VM_SAO | \ + 0)/* signals */ extern int checkpoint_obj_sighand (struct ckpt_ctx *ctx,struct task_struct *t);Signature · 6 lines
1.7.2.2 _______________________________________________ Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org https://lists.linux-foundation.org/mailman/listinfo/containers
PATCH 4/11 checkpoint: introduce device vma type
In reply to a message not in the archiveThis is intended to be used by drivers that allow userspace to map hardware resources via mmap(2). The mapping is restored but we don't worry about the contents. This is pretty much how we treat shared file mappings, where it is the user's responsibility to ensure file (device) availability and integrity for restart. I think this is a reasonable approach for the timer implementations in drivers/char as well as the bsr driver (for which a patch follows).
--- include/linux/checkpoint.h | 3 ++- include/linux/checkpoint_hdr.h | 2 ++ mm/checkpoint.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletions(-)
include/linux/checkpoint.h +2 -1
@@ -290,7 +290,8 @@ extern int shmem_vma_checkpoint(struct ckpt_ctx *ctx,struct vm_area_struct *vma, enum vma_type type, int ino_objref); - +extern int device_vma_checkpoint (struct ckpt_ctx *ctx, +struct vm_area_struct *vma);extern int checkpoint_obj_mm (struct ckpt_ctx *ctx,struct task_struct *t);extern int restore_obj_mm (struct ckpt_ctx *ctx,int mm_objref);
include/linux/checkpoint_hdr.h +2 -0
@@ -914,6 +914,8 @@ enum vma_type {#define CKPT_VMA_SHM_IPC CKPT_VMA_SHM_IPC CKPT_VMA_SHM_IPC_SKIP, /* shared sysvipc (skip contents) */#define CKPT_VMA_SHM_IPC_SKIP CKPT_VMA_SHM_IPC_SKIP + CKPT_VMA_DEVICE, /* c/r mapping only, skip contents */ +#define CKPT_VMA_DEVICE CKPT_VMA_DEVICE CKPT_VMA_MAX,#define CKPT_VMA_MAX CKPT_VMA_MAX };
mm/checkpoint.c +37 -0
@@ -591,6 +591,20 @@ static int anonymous_checkpoint(struct ckpt_ctx *ctx,return private_vma_checkpoint (ctx, vma,CKPT_VMA_ANON ,0 ); } +int device_vma_checkpoint (struct ckpt_ctx *ctx,struct vm_area_struct *vma) +{ +int vma_objref; +int ret; + + vma_objref =checkpoint_obj (ctx, vma->vm_file,CKPT_OBJ_FILE ); +if (vma_objref <0 ) +return vma_objref; + + ret =generic_vma_checkpoint (ctx, vma,CKPT_VMA_DEVICE , vma_objref,0 ); + +return ret; +} +static int checkpoint_vmas (struct ckpt_ctx *ctx,struct mm_struct *mm) {struct vm_area_struct *vma, *next;
@@ -1114,6 +1128,23 @@ static int bad_vma_restore(struct ckpt_ctx *ctx,return -EINVAL ; } +static int device_vma_restore (struct ckpt_ctx *ctx, +struct mm_struct *mm, +struct ckpt_hdr_vma *h) +{ +unsigned long addr; +struct file *file; + + file =ckpt_obj_fetch (ctx, h->vma_objref,CKPT_OBJ_FILE ); +if (IS_ERR (file)) +return PTR_ERR (file); + + addr =generic_vma_restore (mm, file, h); + +return IS_ERR ((void *)addr) ?PTR_ERR ((void *)addr) :0 ; +} + +/* callbacks to restore vma per its type: */ struct restore_vma_ops {char *vma_name;
@@ -1180,6 +1211,12 @@ static struct restore_vma_ops restore_vma_ops[] = { .vma_type = CKPT_VMA_SHM_IPC_SKIP, .restore = ipcshm_restore, }, +/* device memory - restore mapping, not contents */ + { + .vma_name = "DEVICE", + .vma_type = CKPT_VMA_DEVICE, + .restore = device_vma_restore, + }, };/**
Signature · 1 line
1.7.2.2
A message that is not in the archive (sent off-list or not yet received): 1287601006-13794-5-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
Re: [PATCH 04/11] checkpoint: introduce device vma type
Hi,
Thanks for bringing up the issue.
We clearly will need device-specific vma types (in plural!), and I suspect that the way it will work is that devices will register their vma types at boot time or dynamically (for kernel modules).
Quoted 7 lines · Nathan Lynch
This is intended to be used by drivers that allow userspace to map hardware resources via mmap(2). The mapping is restored but we don't worry about the contents. This is pretty much how we treat shared file mappings, where it is the user's responsibility to ensure file (device) availability and integrity for restart. I think this is a reasonable approach for the timer implementations in
drivers/charas well as the bsr driver (for which a patch follows).
The given use case is for a specific device, and assumes special userspace behavior and awareness (if not the application, at least the admin that runs the c/r).
A similar solution will also apply for memory regions marked by the process as "scratch" - a way for programmers to tell the kernel that certain memory need not be saved/restored beyond the mapping.
I'm a bit concerned about tying this behavior permanently to a drivers. (Although, it may make sense for some drivers). What do you think ?
Otherwise, the patch looks correct. Perhaps modify the types to something more generic, like CKPT_VMA_VANILLA ?
Thanks,
Oren.
Quoted 97 lines
Signed-off-by Nathan Lynch <[email protected]>--- include/linux/checkpoint.h | 3 ++- include/linux/checkpoint_hdr.h | 2 ++ mm/checkpoint.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletions(-)include/linux/checkpoint.h +2
-1@@ -290,7 +290,8 @@ extern int shmem_vma_checkpoint(struct ckpt_ctx *ctx,struct vm_area_struct *vma, enum vma_type type, int ino_objref); - +extern int device_vma_checkpoint (struct ckpt_ctx *ctx, +struct vm_area_struct *vma);extern int checkpoint_obj_mm (struct ckpt_ctx *ctx,struct task_struct *t);extern int restore_obj_mm (struct ckpt_ctx *ctx,int mm_objref);include/linux/checkpoint_hdr.h +2
-0@@ -914,6 +914,8 @@ enum vma_type {#define CKPT_VMA_SHM_IPC CKPT_VMA_SHM_IPC CKPT_VMA_SHM_IPC_SKIP, /* shared sysvipc (skip contents) */#define CKPT_VMA_SHM_IPC_SKIP CKPT_VMA_SHM_IPC_SKIP + CKPT_VMA_DEVICE, /* c/r mapping only, skip contents */ +#define CKPT_VMA_DEVICE CKPT_VMA_DEVICE CKPT_VMA_MAX,#define CKPT_VMA_MAX CKPT_VMA_MAX };mm/checkpoint.c +37
-0@@ -591,6 +591,20 @@ static int anonymous_checkpoint(struct ckpt_ctx *ctx,return private_vma_checkpoint (ctx, vma,CKPT_VMA_ANON ,0 ); } +int device_vma_checkpoint (struct ckpt_ctx *ctx,struct vm_area_struct *vma) +{ +int vma_objref; +int ret; + + vma_objref =checkpoint_obj (ctx, vma->vm_file,CKPT_OBJ_FILE ); +if (vma_objref <0 ) +return vma_objref; + + ret =generic_vma_checkpoint (ctx, vma,CKPT_VMA_DEVICE , vma_objref,0 ); + +return ret; +} +static int checkpoint_vmas (struct ckpt_ctx *ctx,struct mm_struct *mm) {struct vm_area_struct *vma, *next;@@ -1114,6 +1128,23 @@ static int bad_vma_restore(struct ckpt_ctx *ctx,return -EINVAL ; } +static int device_vma_restore (struct ckpt_ctx *ctx, +struct mm_struct *mm, +struct ckpt_hdr_vma *h) +{ +unsigned long addr; +struct file *file; + + file =ckpt_obj_fetch (ctx, h->vma_objref,CKPT_OBJ_FILE ); +if (IS_ERR (file)) +return PTR_ERR (file); + + addr =generic_vma_restore (mm, file, h); + +return IS_ERR ((void *)addr) ?PTR_ERR ((void *)addr) :0 ; +} + +/* callbacks to restore vma per its type: */ struct restore_vma_ops {char *vma_name;@@ -1180,6 +1211,12 @@ static struct restore_vma_ops restore_vma_ops[] = { .vma_type = CKPT_VMA_SHM_IPC_SKIP, .restore = ipcshm_restore, }, +/* device memory - restore mapping, not contents */ + { + .vma_name = "DEVICE", + .vma_type = CKPT_VMA_DEVICE, + .restore = device_vma_restore, + }, };/**
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 04/11] checkpoint: introduce device vma type
Quoted 26 lines · Oren Laadan
Hi,
Thanks for bringing up the issue.
We clearly will need device-specific vma types (in plural!), and I suspect that the way it will work is that devices will register their vma types at boot time or dynamically (for kernel modules).
Quoted 7 lines · Nathan Lynch
This is intended to be used by drivers that allow userspace to map hardware resources via mmap(2). The mapping is restored but we don't worry about the contents. This is pretty much how we treat shared file mappings, where it is the user's responsibility to ensure file (device) availability and integrity for restart. I think this is a reasonable approach for the timer implementations in
drivers/charas well as the bsr driver (for which a patch follows).The given use case is for a specific device, and assumes special userspace behavior and awareness (if not the application, at least the admin that runs the c/r).
A similar solution will also apply for memory regions marked by the process as "scratch" - a way for programmers to tell the kernel that certain memory need not be saved/restored beyond the mapping.
Quoted 6 lines
I'm a bit concerned about tying this behavior permanently to a drivers. (Although, it may make sense for some drivers). What do you think ?
Otherwise, the patch looks correct. Perhaps modify the types to something more generic, like
CKPT_VMA_VANILLA?
My use case has disappeared in the interim and I've moved on to other matters, so I'm inclined to defer c/r of device mappings until another user comes along.
PATCH 5/11 checkpoint: allow VM_{IO,RESERVED,PFNMAP} mappings
In reply to a message not in the archiveThis is necessary for checkpoint/restart of BSR device (and likely hpet and other timer device) mappings.
--- include/linux/checkpoint.h | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
include/linux/checkpoint.h +0 -3
@@ -313,12 +313,9 @@ extern int restore_memory_contents(struct ckpt_ctx *ctx, struct inode *inode);#define CKPT_VMA_NOT_SUPPORTED ( \ VM_HUGETLB | \ VM_INSERTPAGE | \ - VM_IO | \ VM_MAPPED_COPY | \ VM_MIXEDMAP | \ VM_NONLINEAR | \ - VM_PFNMAP | \ - VM_RESERVED | \ VM_SAO | \ 0)
Signature · 1 line
1.7.2.2
A message that is not in the archive (sent off-list or not yet received): 1287601006-13794-6-git-send-email-ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
Re: [PATCH 05/11] checkpoint: allow VM_{IO,RESERVED,PFNMAP} mappings
Hi,
I'm not too familiar with all the uses of VM_{IO,RESERVED,PFNMAP} flags. Should I be concerned about missing out cases where the checkpoint succeeds but the restart will fail (or worse, succeed but not work correctly thereafter) ?
If these are only "used" by devices, then no problem - they won't checkpoint unless they have the code to support c/r. But are they used elsewhere ?
If so, perhaps we should find a way to encode these constraints differently, e.g., only allow these flags if there is vma->vm_file which has a .checkpoint operation valid ?
Oren.
Quoted 25 lines · Nathan Lynch
This is necessary for checkpoint/restart of BSR device (and likely hpet and other timer device) mappings.
Signed-off-by Nathan Lynch <[email protected]>--- include/linux/checkpoint.h | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)include/linux/checkpoint.h +0
-3@@ -313,12 +313,9 @@ extern int restore_memory_contents(struct ckpt_ctx *ctx, struct inode *inode);#define CKPT_VMA_NOT_SUPPORTED ( \ VM_HUGETLB | \ VM_INSERTPAGE | \ - VM_IO | \ VM_MAPPED_COPY | \ VM_MIXEDMAP | \ VM_NONLINEAR | \ - VM_PFNMAP | \ - VM_RESERVED | \ VM_SAO | \ 0)
PATCH 6/11 checkpoint: enable c/r for bsr driver
In reply to a message not in the archiveBSR (Barrier Synchronization Register) is a IBM POWER-specific register which can be used for fast synchronization on large systems without cacheline bouncing. This is a system-wide register and it is not virtualized or context-switched.
Enable checkpoint and restart of BSR device mappings. It is up to the user/admin to initialize a job's BSR correctly when restarting or migrating.
--- drivers/char/bsr.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
drivers/char/bsr.c +13 -0
@@ -24,6 +24,7 @@#include <linux/of_device.h> #include <linux/of_platform.h> #include <linux/module.h> +#include <linux/checkpoint.h> #include <linux/cdev.h> #include <linux/list.h> #include <linux/mm.h>
@@ -116,6 +117,12 @@ static struct device_attribute bsr_dev_attrs[] = { __ATTR_NULL }; +#ifdef CONFIG_CHECKPOINT +static const struct vm_operations_struct bsr_vm_ops = { + .checkpoint = device_vma_checkpoint, +}; +#endif +static int bsr_mmap (struct file *filp,struct vm_area_struct *vma) {unsigned long size = vma->vm_end - vma->vm_start;
@@ -138,6 +145,9 @@ static int bsr_mmap(struct file *filp, struct vm_area_struct *vma)if (ret)return -EAGAIN ; +#ifdef CONFIG_CHECKPOINT + vma->vm_ops = &bsr_vm_ops; +#endif return 0 ; }
@@ -154,6 +164,9 @@ static const struct file_operations bsr_fops = { .owner = THIS_MODULE, .mmap = bsr_mmap, .open = bsr_open, +#ifdef CONFIG_CHECKPOINT + .checkpoint = generic_file_checkpoint, +#endif };static void bsr_cleanup_devs (void )
Signature · 1 line
1.7.2.2
PATCH 7/11 checkpoint/ipc: allow shmat callers to specify ipc namespace
In reply to a message not in the archiveRestore of huge page shm regions will require that the restarting process temporarily shmat-attach to regions which are not in the current ipc namespace. Add an ipc_namespace argument to do_shmat_pgoff; convert callers to pass current->nsproxy->ipc_ns.
This depends on the patch "support ipc shm regions which are partially mapped" posted to the containers list on 6 August.
--- include/linux/shm.h | 8 +++++--- ipc/shm.c | 18 +++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-)
include/linux/shm.h +5 -3
@@ -104,10 +104,12 @@ struct shmid_kernel /* private to the kernel */#define SHM_NORESERVE 010000/* don't check for reservations */ #ifdef CONFIG_SYSVIPC +struct ipc_namespace ; +long do_shmat (int shmid,char __user *shmaddr,int shmflg,unsigned long *addr); -long do_shmat_pgoff (int shmid,char __user *shmaddr, -int shmflg,unsigned long *addr, -unsigned long shmsize,unsigned long shmpgoff); +long do_shmat_ns_pgoff (struct ipc_namespace *ns,int shmid, +char __user *shmaddr,int shmflg,unsigned long *addr, +unsigned long shmsize,unsigned long shmpgoff);extern int is_file_shm_hugepages (struct file *file);#else static inline long do_shmat(int shmid, char __user *shmaddr,
ipc/shm.c +9 -9
@@ -321,6 +321,7 @@ static int ipcshm_checkpoint(struct ckpt_ctx *ctx, struct vm_area_struct *vma)int ipcshm_restore (struct ckpt_ctx *ctx,struct mm_struct *mm,struct ckpt_hdr_vma *h) { +struct ipc_namespace *ipcns = current->nsproxy->ipc_ns;struct file *file;int shmid, shmflg =0 ;unsigned long start;
@@ -352,10 +353,9 @@ int ipcshm_restore(struct ckpt_ctx *ctx, struct mm_struct *mm,*/ start = (unsigned long ) h->vm_start; size = h->vm_end - h->vm_start; - ret =do_shmat_pgoff (shmid, (char __user *) start, shmflg, &addr, -min (size, (unsigned long ) h->ino_size), - h->vm_pgoff <<PAGE_SHIFT ); - + ret =do_shmat_ns_pgoff (ipcns, shmid, (char __user *) start, shmflg, + &addr,min (size, (unsigned long ) h->ino_size), + h->vm_pgoff <<PAGE_SHIFT );BUG_ON (ret >=0 && addr != h->vm_start);return ret; }
@@ -885,8 +885,9 @@ out:* "raddr" thing points to kernel space, and there has to be a wrapper around * this. */ -long do_shmat_pgoff (int shmid,char __user *shmaddr,int shmflg, -ulong *raddr,ulong shmsize,ulong shmpgoff) +long do_shmat_ns_pgoff (struct ipc_namespace *ns,int shmid, +char __user *shmaddr,int shmflg,ulong *raddr, +ulong shmsize,ulong shmpgoff) {struct shmid_kernel *shp;unsigned long addr;
@@ -898,7 +899,6 @@ long do_shmat_pgoff(int shmid, char __user *shmaddr, int shmflg,unsigned long prot;int acc_mode;unsigned long user_addr; -struct ipc_namespace *ns;struct shm_file_data *sfd;struct path path;fmode_t f_mode;
@@ -942,7 +942,6 @@ long do_shmat_pgoff(int shmid, char __user *shmaddr, int shmflg,* We cannot rely on the fs check since SYSV IPC does have an * additional creator id... */ - ns = current->nsproxy->ipc_ns; shp =shm_lock_check (ns, shmid);if (IS_ERR (shp)) { err =PTR_ERR (shp);
@@ -1050,7 +1049,8 @@ out_put_dentry:*/ long do_shmat (int shmid,char __user *shmaddr,int shmflg,ulong *raddr) { -return do_shmat_pgoff (shmid, shmaddr, shmflg, raddr,0 ,0 ); +return do_shmat_ns_pgoff (current->nsproxy->ipc_ns, shmid, shmaddr, + shmflg, raddr,0 ,0 ); } SYSCALL_DEFINE3(shmat, int, shmid, char __user *, shmaddr, int, shmflg)
Signature · 1 line
1.7.2.2
PATCH 8/11 checkpoint/restart of anonymous hugetlb mappings
In reply to a message not in the archiveSupport checkpoint and restore of both private and shared hugepage-backed mappings established via mmap(MAP_HUGETLB). Introduce APIs for checkpoint and restart of individual huge pages which are to be used by the sysv SHM_HUGETLB c/r code.
--- include/linux/checkpoint.h | 3 + include/linux/checkpoint_hdr.h | 16 +++ include/linux/hugetlb.h | 11 ++ mm/checkpoint.c | 13 ++ mm/hugetlb.c | 257 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 300 insertions(+), 0 deletions(-)
include/linux/checkpoint.h +3 -0
@@ -304,6 +304,9 @@ extern unsigned long generic_vma_restore(struct mm_struct *mm,extern int private_vma_restore (struct ckpt_ctx *ctx,struct mm_struct *mm,struct file *file,struct ckpt_hdr_vma *h); +extern int hugetlb_restore (struct ckpt_ctx *ctx,struct mm_struct *mm, +struct ckpt_hdr_vma *hdr); +extern int checkpoint_memory_contents (struct ckpt_ctx *ctx,struct vm_area_struct *vma,struct inode *inode);
include/linux/checkpoint_hdr.h +16 -0
@@ -166,6 +166,8 @@ enum {#define CKPT_HDR_VMA CKPT_HDR_VMA CKPT_HDR_PGARR,#define CKPT_HDR_PGARR CKPT_HDR_PGARR + CKPT_HDR_HPAGE, +#define CKPT_HDR_HPAGE CKPT_HDR_HPAGE CKPT_HDR_MM_CONTEXT,#define CKPT_HDR_MM_CONTEXT CKPT_HDR_MM_CONTEXT
@@ -916,6 +918,10 @@ enum vma_type {#define CKPT_VMA_SHM_IPC_SKIP CKPT_VMA_SHM_IPC_SKIP CKPT_VMA_DEVICE, /* c/r mapping only, skip contents */#define CKPT_VMA_DEVICE CKPT_VMA_DEVICE + CKPT_VMA_HUGETLB, +#define CKPT_VMA_HUGETLB CKPT_VMA_HUGETLB + CKPT_VMA_HUGETLB_SKIP, +#define CKPT_VMA_HUGETLB_SKIP CKPT_VMA_HUGETLB_SKIP CKPT_VMA_MAX,#define CKPT_VMA_MAX CKPT_VMA_MAX };
@@ -942,6 +948,16 @@ struct ckpt_hdr_pgarr {__u64 nr_pages;/* number of pages to saved */ } __attribute__((aligned(8))); +/* huge page */ +struct ckpt_hdr_hpage { +struct ckpt_hdr h; +union { +__u64 vaddr; +__u64 index; + }; +__u16 shift; +} __attribute__((aligned (8 ))); +/* signals */ struct ckpt_sigset {__u8 sigset[CKPT_ARCH_NSIG /8 ];
include/linux/hugetlb.h +11 -0
@@ -47,6 +47,8 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to,struct vm_area_struct *vma, int acctflags);void hugetlb_unreserve_pages (struct inode *inode,long offset,long freed); +int hugetlb_restore_page (struct ckpt_ctx *ctx,struct page *page); +int hugetlb_checkpoint_page (struct ckpt_ctx *ctx,struct page *page);extern unsigned long hugepages_treat_as_movable;extern const unsigned long hugetlb_zero, hugetlb_infinity;
@@ -323,6 +325,15 @@ static inline unsigned int pages_per_huge_page(struct hstate *h) {return 1 ; } + +static inline int hugetlb_restore_page (struct ckpt_ctx *ctx,struct page *page) +{ +return -ENOSYS ; +} +static inline int hugetlb_checkpoint_page (struct ckpt_ctx *ctx,struct page *page) +{ +return -ENOSYS ; +}#endif #endif /* _LINUX_HUGETLB_H */
mm/checkpoint.c +13 -0
@@ -1035,6 +1035,8 @@ static unsigned long calc_map_flags_bits(unsigned long orig_vm_flags) vm_flags |=MAP_PRIVATE ;if (orig_vm_flags &VM_NORESERVE ) vm_flags |=MAP_NORESERVE ; +if (orig_vm_flags &VM_HUGETLB ) + vm_flags |=MAP_HUGETLB ;return vm_flags; }
@@ -1217,6 +1219,17 @@ static struct restore_vma_ops restore_vma_ops[] = { .vma_type = CKPT_VMA_DEVICE, .restore = device_vma_restore, }, +/* hugeltb */ + { + .vma_name = "HUGETLB", + .vma_type = CKPT_VMA_HUGETLB, + .restore = hugetlb_restore, + }, + { + .vma_name = "HUGETLB (SKIP)", + .vma_type = CKPT_VMA_HUGETLB_SKIP, + .restore = hugetlb_restore, + }, };/**
mm/hugetlb.c +257 -0
274 lines not on this page · raw message
Signature · 1 line
1.7.2.2
PATCH 9/11 hugetlbfs checkpoint/restart hooks
In reply to a message not in the archiveAdd the necessary plumbing to to checkpoint open hugetlbfs files.
--- fs/hugetlbfs/inode.c | 24 +++++++++++++++++++++++- 1 files changed, 23 insertions(+), 1 deletions(-)
fs/hugetlbfs/inode.c +23 -1
@@ -21,6 +21,7 @@#include <linux/string.h> #include <linux/capability.h> #include <linux/ctype.h> +#include <linux/checkpoint.h> #include <linux/backing-dev.h> #include <linux/hugetlb.h> #include <linux/pagevec.h>
@@ -463,6 +464,24 @@ out:return error; } +#ifdef CONFIG_CHECKPOINT +static const struct file_operations hugetlbfs_dir_operations = { +/* Just like simple_dir_operations except... */ + .open = dcache_dir_open, + .release = dcache_dir_close, + .llseek = dcache_dir_lseek, + .read = generic_read_dir, + .readdir = dcache_readdir, + .fsync = simple_sync_file, + +/* The checkpoint ops are unlike simple_dir_operations */ + .checkpoint = generic_file_checkpoint, +}; +#else +#define hugetlbfs_dir_operations simple_dir_operations +#endif + +static struct inode *hugetlbfs_get_inode (struct super_block *sb,uid_t uid,gid_t gid,int mode,dev_t dev) {
@@ -497,7 +516,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid,break ;case S_IFDIR : inode->i_op = &hugetlbfs_dir_inode_operations; - inode->i_fop = &simple_dir_operations; + inode->i_fop = &hugetlbfs_dir_operations;/* directory inodes start off with i_nlink == 2 (for "." entry) */ inc_nlink (inode);
@@ -690,6 +709,9 @@ const struct file_operations hugetlbfs_file_operations = { .mmap = hugetlbfs_file_mmap, .fsync = simple_sync_file, .get_unmapped_area = hugetlb_get_unmapped_area, +#ifdef CONFIG_CHECKPOINT + .checkpoint = generic_file_checkpoint, +#endif };static const struct inode_operations hugetlbfs_dir_inode_operations = {
Signature · 1 line
1.7.2.2
PATCH 10/11 checkpoint/restart of SysV SHM_HUGETLB regions
In reply to a message not in the archiveLarge page-backed shm regions require special handling, especially during restart. The association of a large page with a shm region's inode can occur only in the context of a process causing a fault with the region mapped into its mm. In order to restore that association, temporarily shmat-attach the restored SHM_HUGETLB region to the restarting process's mm, using the just-restored ipc namespace instead of the current one (the nsproxy switch hasn't occured yet).
Since the temporary shmat of the region during restart causes some of the shm attributes to be updated, re-restore them from the ipc_shm checkpoint header after unmapping.
--- ipc/checkpoint_shm.c | 154 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 142 insertions(+), 12 deletions(-)
ipc/checkpoint_shm.c +142 -12
@@ -32,6 +32,69 @@* ipc checkpoint */ +#define CKPT_HDR_HPAGE_LAST ~(0UL) +static bool ckpt_hdr_hpage_last (const struct ckpt_hdr_hpage *hdr) +{ +return hdr->index ==CKPT_HDR_HPAGE_LAST ; +} + +static void ckpt_hdr_hpage_init (struct ckpt_hdr_hpage *hdr,unsigned long shift) +{ + hdr->h.type =CKPT_HDR_HPAGE ; + hdr->h.len =sizeof (struct ckpt_hdr_hpage ); + hdr->shift = shift; + hdr->index =0 ;/* to be filled in by user */ +} + +static int shm_hugetlb_checkpoint_contents (struct ckpt_ctx *ctx,struct file *filp) +{ +struct hstate *h =hstate_file (filp); +struct address_space *mapping = filp->f_mapping; +struct inode *inode = mapping->host; +struct ckpt_hdr_hpage hdr; +unsigned long end_index; +unsigned long index; +ssize_t retval =0 ; +loff_t isize; + + isize =i_size_read (inode); +if (isize ==0 ) + goto out; + + end_index = (isize -1 ) >>huge_page_shift (h); + +ckpt_hdr_hpage_init (&hdr,huge_page_shift (h)); + +for (index =0 ; index < end_index +1 ; index++) { +struct page *page; + + page =find_get_page (mapping, index); + +/* skip holes */ +if (!page) +continue ; + + hdr.index = index; + + retval =ckpt_write_obj (ctx, &hdr.h); +if (retval <0 ) + goto release; + + retval =hugetlb_checkpoint_page (ctx, page); +release: +page_cache_release (page); +if (retval <0 ) +break ; + } + +if (retval <0 ) + goto out; + hdr.index =CKPT_HDR_HPAGE_LAST ; + retval =ckpt_write_obj (ctx, &hdr.h); +out: +return retval; +} +/* called with the msgids->rw_mutex is read-held */ static int fill_ipc_shm_hdr(struct ckpt_ctx *ctx, struct ckpt_hdr_ipc_shm *h,
@@ -59,10 +122,8 @@ static int fill_ipc_shm_hdr(struct ckpt_ctx *ctx, h->flags =0 ; -/* check if shm was setup with SHM_HUGETLB (unsupported yet) */ if (is_file_hugepages (shp->shm_file)) { -pr_warning ("c/r: unsupported SHM_HUGETLB\n" ); - ret = -ENOSYS ; + h->flags |=SHM_HUGETLB ; }else {struct shmem_inode_info *info;
@@ -117,7 +178,10 @@ int checkpoint_ipc_shm(int id, void *p, void *data)if (ret <0 ) goto out; - ret =checkpoint_memory_contents (ctx,NULL , inode); +if (is_file_hugepages (shp->shm_file)) + ret =shm_hugetlb_checkpoint_contents (ctx, shp->shm_file); +else + ret =checkpoint_memory_contents (ctx,NULL , inode); out:ckpt_hdr_put (ctx, h);return ret;
@@ -149,6 +213,75 @@ struct dq_ipcshm_del {int id; }; +static void __load_ipc_shm_hdr (const struct ckpt_hdr_ipc_shm *h,struct shmid_kernel *shp) +{ + shp->shm_atim = h->shm_atim; + shp->shm_dtim = h->shm_dtim; + shp->shm_ctim = h->shm_ctim; + shp->shm_cprid = h->shm_cprid; + shp->shm_lprid = h->shm_lprid; +} + +static int shm_hugetlb_restore_contents (struct ckpt_ctx *ctx,struct ipc_namespace *ipcns,struct shmid_kernel *shp,const struct ckpt_hdr_ipc_shm *hdr) +{ +unsigned long start; +int ret; + + ret =do_shmat_ns_pgoff (ipcns, shp->shm_perm.id, (char __user *)0 , +0 , &start,0 ,0 ); +if (ret !=0 ) +return ret; + +ckpt_debug ("temporarily using %#lx for huge shm restore\n" , start); + +while (1 ) { +struct ckpt_hdr_hpage *hdr; +unsigned long hpagesize; +unsigned long index; +unsigned long addr; +struct page *page; +bool last; + + hdr =ckpt_read_obj_type (ctx,sizeof (*hdr),CKPT_HDR_HPAGE ); +if (IS_ERR (hdr)) { + ret =PTR_ERR (hdr); +break ; + } + + last =ckpt_hdr_hpage_last (hdr); + index = (unsigned long )hdr->index; + hpagesize =1UL << hdr->shift; + +ckpt_hdr_put (ctx, hdr); + +if (last) +break ; + + addr = start + (hpagesize * index); + +down_read (¤t->mm->mmap_sem); + ret =get_user_pages (current, current->mm, addr,1 ,1 ,1 , + &page,NULL ); +up_read (¤t->mm->mmap_sem); + +if (ret <0 ) +break ; + + ret =hugetlb_restore_page (ctx, page); + +page_cache_release (page); + +if (ret <0 ) +break ; + } + +sys_shmdt ((void __user *)start); + +__load_ipc_shm_hdr (hdr, shp); + +return ret; +} +static int _ipc_shm_delete (struct ipc_namespace *ns,int id) {mm_segment_t old_fs;
@@ -190,11 +323,7 @@ static int load_ipc_shm_hdr(struct ckpt_ctx *ctx,if (h->shm_cprid <0 || h->shm_lprid <0 )return -EINVAL ; - shp->shm_atim = h->shm_atim; - shp->shm_dtim = h->shm_dtim; - shp->shm_ctim = h->shm_ctim; - shp->shm_cprid = h->shm_cprid; - shp->shm_lprid = h->shm_lprid; +__load_ipc_shm_hdr (h, shp);return 0 ; }
@@ -224,8 +353,6 @@ int restore_ipc_shm(struct ckpt_ctx *ctx, struct ipc_namespace *ns) ret = -ENOSYS ;if (h->mlock_uid != (unsigned int )-1 )/* FIXME: support SHM_LOCK */ goto out; -if (h->flags &SHM_HUGETLB )/* FIXME: support SHM_HUGETLB */ - goto out; shmflag = h->flags | h->perms.mode |IPC_CREAT |IPC_EXCL ; ckpt_debug("shm: do_shmget size %lld flag %#x id %d\n",
@@ -294,7 +421,10 @@ int restore_ipc_shm(struct ckpt_ctx *ctx, struct ipc_namespace *ns) ret =ckpt_obj_insert (ctx, file, h->objref,CKPT_OBJ_FILE );if (ret <0 ) goto fput; - ret =restore_memory_contents (ctx, file->f_dentry->d_inode); +if (is_file_hugepages (file)) + ret =shm_hugetlb_restore_contents (ctx, ns, shp, h); +else + ret =restore_memory_contents (ctx, file->f_dentry->d_inode); fput:fput (file);
Signature · 1 line
1.7.2.2
PATCH 11/11 remove VM_HUGETLB from CKPT_VMA_NOT_SUPPORTED
In reply to a message not in the archiveNow that the hugetlb c/r support code is in place we can remove VM_HUGETLB from the bitmask of unsupported vma flags.
--- include/linux/checkpoint.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/checkpoint.h +0 -1
@@ -314,7 +314,6 @@ extern int restore_memory_contents(struct ckpt_ctx *ctx, struct inode *inode);#define CKPT_VMA_NOT_SUPPORTED ( \ - VM_HUGETLB | \ VM_INSERTPAGE | \ VM_MAPPED_COPY | \ VM_MIXEDMAP | \
Signature · 1 line
1.7.2.2
cover Checkpoint/restart support for HUGETLB pages
In reply to a message not in the archiveThe following 4 patches add supoprt for c/r of HUGETLB pages. They are based on the original post by Nathan Lynch:
https://lists.linux-foundation.org/pipermail/containers/2010-October/025794.html
Nathan:
I did some serious refactoring of your patches to be able to re-use the existing infrastructure for memory-dump/restore in our code. It would be great if you could double check that the results makes sense.
Also, I noticed that during restart the code ignored the 'shift' (or huge page size?) and assumed the default one is used, while in other places it does use the @shift value. Should there not be at least some sanity test and a clear error message in case of mismatch ?
Thanks,
Oren.
PATCH 1/4 c/r: pass file instead of inode to checkpoint_memory_pointer
In reply to a message not in the archiveThis patch prepares the ground for a smooth integration of the support for hugetlb page coming in following patches.
--- include/linux/checkpoint.h | 4 ++-- ipc/checkpoint_shm.c | 4 ++-- mm/checkpoint.c | 35 ++++++++++++++++++++++------------- mm/shmem.c | 2 +- 4 files changed, 27 insertions(+), 18 deletions(-)
include/linux/checkpoint.h +2 -2
@@ -299,8 +299,8 @@ extern int private_vma_restore(struct ckpt_ctx *ctx, struct mm_struct *mm,extern int checkpoint_memory_contents (struct ckpt_ctx *ctx,struct vm_area_struct *vma, -struct inode *inode); -extern int restore_memory_contents (struct ckpt_ctx *ctx,struct inode *inode); +struct file *file); +extern int restore_memory_contents (struct ckpt_ctx *ctx,struct file *file);#define CKPT_VMA_NOT_SUPPORTED \
ipc/checkpoint_shm.c +2 -2
@@ -117,7 +117,7 @@ int checkpoint_ipc_shm(int id, void *p, void *data)if (ret <0 ) goto out; - ret =checkpoint_memory_contents (ctx,NULL , inode); + ret =checkpoint_memory_contents (ctx,NULL , shp->shm_file); out:ckpt_hdr_put (ctx, h);return ret;
@@ -294,7 +294,7 @@ int restore_ipc_shm(struct ckpt_ctx *ctx, struct ipc_namespace *ns) ret =ckpt_obj_insert (ctx, file, h->objref,CKPT_OBJ_FILE );if (ret <0 ) goto fput; - ret =restore_memory_contents (ctx, file->f_dentry->d_inode); + ret =restore_memory_contents (ctx, file); fput:fput (file);
mm/checkpoint.c +22 -13
@@ -231,15 +231,16 @@ static struct page *consider_private_page(struct vm_area_struct *vma,/** * consider_shared_page - return page pointer for dirty pages -* @ino - inode of shmem object +* @file - file of shmem object * @idx - page index in shmem object * * Looks up the page that corresponds to the index in the shmem object, * and returns the page if it was modified (and grabs a reference to it), * or otherwise returns NULL (or error). */ -static struct page *consider_shared_page (struct inode *ino,unsigned long idx) +static struct page *consider_shared_page (struct file *file,unsigned long idx) { +struct ino *inode = file->f_dentfy->d_inode;struct page *page =NULL ;int ret;
@@ -286,18 +287,22 @@ static struct page *consider_shared_page(struct inode *ino, unsigned long idx)* Returns the number of pages collected */ static int vma_fill_pgarr (struct ckpt_ctx *ctx, -struct vm_area_struct *vma,struct inode *inode, +struct vm_area_struct *vma,struct file *file,unsigned long *start,unsigned long end) {unsigned long addr = *start;struct ckpt_pgarr *pgarr; +struct inode *inode;int nr_used;int cnt =0 ; -BUG_ON (inode && vma); +BUG_ON (file && vma);if (vma)down_read (&vma->vm_mm->mmap_sem); +else + inode = file->f_dentry->d_inode; + do { pgarr = pgarr_current(ctx); if (!pgarr) {
@@ -313,7 +318,7 @@ static int vma_fill_pgarr(struct ckpt_ctx *ctx,if (vma) page =consider_private_page (vma, addr);else - page =consider_shared_page (inode, addr); + page =consider_shared_page (file, addr);if (IS_ERR (page)) { cnt =PTR_ERR (page);
@@ -409,20 +414,21 @@ static int vma_dump_pages(struct ckpt_ctx *ctx, int total)*/ int checkpoint_memory_contents (struct ckpt_ctx *ctx,struct vm_area_struct *vma, -struct inode *inode) +struct file *file) {struct ckpt_hdr_pgarr *h;unsigned long addr, end;int cnt, ret; -BUG_ON (vma && inode); +BUG_ON (vma && file);if (vma) { addr = vma->vm_start; end = vma->vm_end; }else { + end =PAGE_ALIGN (i_size_read (file->f_dentry->d_inode)) + >>PAGE_CACHE_SHIFT ; addr =0 ; - end =PAGE_ALIGN (i_size_read (inode)) >>PAGE_CACHE_SHIFT ; }/*
@@ -449,7 +455,7 @@ int checkpoint_memory_contents(struct ckpt_ctx *ctx,*/ while (addr < end) { - cnt =vma_fill_pgarr (ctx, vma, inode, &addr, end); + cnt =vma_fill_pgarr (ctx, vma, file, &addr, end);if (cnt ==0 )break ;else if (cnt <0 )
@@ -571,7 +577,7 @@ int shmem_vma_checkpoint(struct ckpt_ctx *ctx, struct vm_area_struct *vma, goto out;if (type ==CKPT_VMA_SHM_ANON_SKIP ) goto out; - ret =checkpoint_memory_contents (ctx,NULL , file->f_dentry->d_inode); + ret =checkpoint_memory_contents (ctx,NULL , file); out:return ret; }
@@ -900,12 +906,15 @@ static struct page *bring_shared_page(unsigned long idx, struct inode *ino)* read_pages_contents - read in data of pages in page-array chain * @ctx - restart context */ -static int read_pages_contents (struct ckpt_ctx *ctx,struct inode *inode) +static int read_pages_contents (struct ckpt_ctx *ctx,struct file *file) {struct ckpt_pgarr *pgarr;unsigned long *vaddrs; +struct inode *inode;int i, ret; + inode = file ? file->f_dentry->d_inode :NULL ; +list_for_each_entry_reverse (pgarr, &ctx->pgarr_list, list) { vaddrs = pgarr->vaddrs;for (i =0 ; i < pgarr->nr_used; i++) {
@@ -944,7 +953,7 @@ static int read_pages_contents(struct ckpt_ctx *ctx, struct inode *inode)* these steps until reaching a header specifying "0" pages, which marks * the end of the contents. */ -int restore_memory_contents (struct ckpt_ctx *ctx,struct inode *inode) +int restore_memory_contents (struct ckpt_ctx *ctx,struct file *file) {struct ckpt_hdr_pgarr *h;unsigned long nr_pages;
@@ -971,7 +980,7 @@ int restore_memory_contents(struct ckpt_ctx *ctx, struct inode *inode) ret =read_pages_vaddrs (ctx, nr_pages);if (ret <0 )break ; - ret =read_pages_contents (ctx, inode); + ret =read_pages_contents (ctx, file);if (ret <0 )break ;pgarr_reset_all (ctx);
mm/shmem.c +1 -1
@@ -2486,7 +2486,7 @@ int shmem_restore(struct ckpt_ctx *ctx,return PTR_ERR ((void *) addr);if (h->vma_type ==CKPT_VMA_SHM_ANON ) - ret =restore_memory_contents (ctx, file->f_dentry->d_inode); + ret =restore_memory_contents (ctx, file); out:fput (file);return ret;
Signature · 1 line
1.7.1
PATCH 2/4 c/r: [ipc] allow shmat callers to specify ipc namespace
In reply to a message not in the archiveFrom: Nathan Lynch <[email protected]>
Restore of huge page shm regions will require that the restarting process temporarily shmat-attach to regions which are not in the current ipc namespace. Add an ipc_namespace argument to do_shmat_pgoff; convert callers to pass current->nsproxy->ipc_ns.
This depends on the patch "support ipc shm regions which are partially mapped" posted to the containers list on 6 August.
--- include/linux/shm.h | 15 ++++++++++----- ipc/shm.c | 17 +++++++++-------- 2 files changed, 19 insertions(+), 13 deletions(-)
include/linux/shm.h +10 -5
@@ -103,11 +103,14 @@ struct shmid_kernel /* private to the kernel */#define SHM_HUGETLB 04000/* segment will use huge TLB pages */ #define SHM_NORESERVE 010000/* don't check for reservations */ +struct ipc_namespace ; +#ifdef CONFIG_SYSVIPC -long do_shmat (int shmid,char __user *shmaddr,int shmflg,unsigned long *addr); -long do_shmat_pgoff (int shmid,char __user *shmaddr, -int shmflg,unsigned long *addr, -unsigned long shmsize,unsigned long shmpgoff); +extern long do_shmat (int shmid,char __user *shmaddr, +int shmflg,unsigned long *addr); +extern long do_shmat_ns_pgoff (struct ipc_namespace *ns,int shmid, +char __user *shmaddr,int shmflg,unsigned long *addr, +unsigned long shmsize,unsigned long shmpgoff);extern int is_file_shm_hugepages (struct file *file);#else static inline long do_shmat(int shmid, char __user *shmaddr,
@@ -115,13 +118,15 @@ static inline long do_shmat(int shmid, char __user *shmaddr, {return -ENOSYS ; } +static inline long do_shmat_ns_pgoff (struct ipc_namespace *ns,int shmid, +char __user *shmaddr,int shmflg,unsigned long *addr, +unsigned long shmsize,unsigned long shmpgoff);static inline int is_file_shm_hugepages (struct file *file) {return 0 ; }#endif -struct ipc_namespace ;extern int shmctl_down (struct ipc_namespace *ns,int shmid,int cmd,struct shmid_ds __user *buf,int version);
ipc/shm.c +9 -8
@@ -322,6 +322,7 @@ static int ipcshm_checkpoint(struct ckpt_ctx *ctx, struct vm_area_struct *vma)int ipcshm_restore (struct ckpt_ctx *ctx,struct mm_struct *mm,struct ckpt_hdr_vma *h) { +struct ipc_namespace *ipcns = current->nsproxy->ipc_ns;struct file *file;int shmid, shmflg =0 ;unsigned long start;
@@ -353,9 +354,9 @@ int ipcshm_restore(struct ckpt_ctx *ctx, struct mm_struct *mm,*/ start = (unsigned long ) h->vm_start; size = h->vm_end - h->vm_start; - ret =do_shmat_pgoff (shmid, (char __user *) start, shmflg, &addr, -min (size, (unsigned long ) h->ino_size), - h->vm_pgoff <<PAGE_SHIFT ); + ret =do_shmat_ns_pgoff (ipcns, shmid, (char __user *) start, shmflg, + &addr,min (size, (unsigned long ) h->ino_size), + h->vm_pgoff <<PAGE_SHIFT );BUG_ON (ret >=0 && addr != h->vm_start);return ret;
@@ -900,8 +901,9 @@ out:* "raddr" thing points to kernel space, and there has to be a wrapper around * this. */ -long do_shmat_pgoff (int shmid,char __user *shmaddr,int shmflg, -ulong *raddr,ulong shmsize,ulong shmpgoff) +long do_shmat_ns_pgoff (struct ipc_namespace *ns,int shmid, +char __user *shmaddr,int shmflg,ulong *raddr, +ulong shmsize,ulong shmpgoff) {struct shmid_kernel *shp;unsigned long addr;
@@ -913,7 +915,6 @@ long do_shmat_pgoff(int shmid, char __user *shmaddr, int shmflg,unsigned long prot;int acc_mode;unsigned long user_addr; -struct ipc_namespace *ns;struct shm_file_data *sfd;struct path path;fmode_t f_mode;
@@ -957,7 +958,6 @@ long do_shmat_pgoff(int shmid, char __user *shmaddr, int shmflg,* We cannot rely on the fs check since SYSV IPC does have an * additional creator id... */ - ns = current->nsproxy->ipc_ns; shp =shm_lock_check (ns, shmid);if (IS_ERR (shp)) { err =PTR_ERR (shp);
@@ -1065,7 +1065,8 @@ out_put_dentry:*/ long do_shmat (int shmid,char __user *shmaddr,int shmflg,ulong *raddr) { -return do_shmat_pgoff (shmid, shmaddr, shmflg, raddr,0 ,0 ); +return do_shmat_ns_pgoff (current->nsproxy->ipc_ns, shmid, shmaddr, + shmflg, raddr,0 ,0 ); } SYSCALL_DEFINE3(shmat, int, shmid, char __user *, shmaddr, int, shmflg)
Signature · 1 line
1.7.1
PATCH 3/4 c/r: checkpoint/restart of anonymous hugetlb mappings
In reply to a message not in the archiveSupport checkpoint and restore of both private and shared hugepage-backed mappings established via mmap(MAP_HUGETLB). Introduce APIs for checkpoint and restart of individual huge pages which are to be used by the sysv SHM_HUGETLB c/r code.
Original patch posted by Nathan Lynch <[email protected]>.
Changelog[v23-rc1]:
- Mofidied to reuse existing code in mm/checkpoint.c (specifically checkpoint_memory_contents() and restore_memory_contents()
- Merge patch that adds the necessary plumbing to to checkpoint open hugetlbfs files.
- Merge patch that removes VM_HUGETLB from CKPT_VMA_NOT_SUPPORTED
--- include/linux/checkpoint.h | 3 +- include/linux/checkpoint_hdr.h | 16 ++++ include/linux/hugetlb.h | 34 +++++++++ ipc/checkpoint_shm.c | 2 +- mm/checkpoint.c | 82 ++++++++++++++++------ mm/hugetlb.c | 157 ++++++++++++++++++++++++++++++++++++++++ mm/shmem.c | 2 +- 7 files changed, 272 insertions(+), 24 deletions(-)
include/linux/checkpoint.h +2 -1
@@ -300,7 +300,8 @@ extern int private_vma_restore(struct ckpt_ctx *ctx, struct mm_struct *mm,extern int checkpoint_memory_contents (struct ckpt_ctx *ctx,struct vm_area_struct *vma,struct file *file); -extern int restore_memory_contents (struct ckpt_ctx *ctx,struct file *file); +extern int restore_memory_contents (struct ckpt_ctx *ctx, +struct file *file,int huge);#define CKPT_VMA_NOT_SUPPORTED \
include/linux/checkpoint_hdr.h +16 -0
@@ -169,6 +169,8 @@ enum {#define CKPT_HDR_VMA CKPT_HDR_VMA CKPT_HDR_PGARR,#define CKPT_HDR_PGARR CKPT_HDR_PGARR + CKPT_HDR_HPAGE, +#define CKPT_HDR_HPAGE CKPT_HDR_HPAGE CKPT_HDR_MM_CONTEXT,#define CKPT_HDR_MM_CONTEXT CKPT_HDR_MM_CONTEXT
@@ -922,6 +924,10 @@ enum vma_type {#define CKPT_VMA_SHM_IPC CKPT_VMA_SHM_IPC CKPT_VMA_SHM_IPC_SKIP, /* shared sysvipc (skip contents) */#define CKPT_VMA_SHM_IPC_SKIP CKPT_VMA_SHM_IPC_SKIP + CKPT_VMA_HUGETLB, +#define CKPT_VMA_HUGETLB CKPT_VMA_HUGETLB + CKPT_VMA_HUGETLB_SKIP, +#define CKPT_VMA_HUGETLB_SKIP CKPT_VMA_HUGETLB_SKIP };/* vma descriptor */
@@ -946,6 +952,16 @@ struct ckpt_hdr_pgarr {__u64 nr_pages;/* number of pages to saved */ } __attribute__((aligned(8))); +/* huge page */ +struct ckpt_hdr_hpage { +struct ckpt_hdr h; +union { +__u64 vaddr; +__u64 index; + }; +__u16 shift; +} __attribute__((aligned (8 ))); +/* signals */ struct ckpt_sigset {__u8 sigset[CKPT_ARCH_NSIG /8 ];
include/linux/hugetlb.h +34 -0
@@ -43,6 +43,13 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to,struct vm_area_struct *vma, int acctflags);void hugetlb_unreserve_pages (struct inode *inode,long offset,long freed); +#ifdef CONFIG_CHECKPOINT +int checkpoint_dump_hugetlb (struct ckpt_ctx *ctx,struct page *page); +int restore_read_hugetlb (struct ckpt_ctx *ctx,struct page *page); +struct page *consider_hugetlb_private_page (struct vm_area_struct *vma, +unsigned long addr); +#endif +int dequeue_hwpoisoned_huge_page (struct page *page);void copy_huge_page (struct page *dst,struct page *src);
@@ -114,6 +121,22 @@ static inline void copy_huge_page(struct page *dst, struct page *src)#define HPAGE_SIZE PAGE_SIZE#endif +#ifdef CONFIG_CHECKPOINT +static inline int checkpoint_dump_hugetlb (struct ckpt_ctx *ctx,struct page *page) +{ +return -ENOSYS ; +} +static inline int restore_read_hugetlb (struct ckpt_ctx *ctx,struct page *page) +{ +return -ENOSYS ; +} +static inline struct page *consider_hugetlb_private_page (struct vm_area_struct *vma, +unsigned long addr) +{ +return ERR_PTR (-ENOSYS ); +} +#endif +#endif /* !CONFIG_HUGETLB_PAGE */ #define HUGETLB_ANON_FILE "anon_hugepage"
@@ -332,4 +355,15 @@ static inline unsigned int pages_per_huge_page(struct hstate *h)#define hstate_index_to_shift (index) 0#endif +#ifdef CONFIG_CHECKPOINT +#ifdef CONFIG_HUGETLB_PAGE +struct ckpt_ctx ; +struct ckpt_hdr_vma ; +extern int hugetlb_restore (struct ckpt_ctx *ctx,struct mm_struct *mm, +struct ckpt_hdr_vma *h); +#else +#define hugetlb_restore NULL +#endif +#endif +#endif /* _LINUX_HUGETLB_H */
ipc/checkpoint_shm.c +1 -1
@@ -294,7 +294,7 @@ int restore_ipc_shm(struct ckpt_ctx *ctx, struct ipc_namespace *ns) ret =ckpt_obj_insert (ctx, file, h->objref,CKPT_OBJ_FILE );if (ret <0 ) goto fput; - ret =restore_memory_contents (ctx, file); + ret =restore_memory_contents (ctx, file,0 ); fput:fput (file);
mm/checkpoint.c +61 -21
214 lines not on this page · raw message
mm/hugetlb.c +157 -0
173 lines not on this page · raw message
mm/shmem.c +1 -1
@@ -2486,7 +2486,7 @@ int shmem_restore(struct ckpt_ctx *ctx,return PTR_ERR ((void *) addr);if (h->vma_type ==CKPT_VMA_SHM_ANON ) - ret =restore_memory_contents (ctx, file); + ret =restore_memory_contents (ctx, file,0 ); out:fput (file);return ret;
Signature · 1 line
1.7.1
PATCH 4/4 c/r: support checkpoint/restart of SysV SHM_HUGETLB regions
In reply to a message not in the archiveLarge page-backed shm regions require special handling, especially during restart. The association of a large page with a shm region's inode can occur only in the context of a process causing a fault with the region mapped into its mm. In order to restore that association, temporarily shmat-attach the restored SHM_HUGETLB region to the restarting process's mm, using the just-restored ipc namespace instead of the current one (the nsproxy switch hasn't occured yet).
Since the temporary shmat of the region during restart causes some of the shm attributes to be updated, re-restore them from the ipc_shm checkpoint header after unmapping.
Original patch by Nathan Lynch <[email protected]>.
Changelog[v23-rc1]:
- Mofidied to reuse existing code in mm/checkpoint.c (specifically checkpoint_memory_contents() and restore_memory_contents()
--- fs/hugetlbfs/inode.c | 23 ++++++++++++++++++++++- include/linux/checkpoint_hdr.h | 3 +++ include/linux/hugetlb.h | 7 +++++++ ipc/checkpoint_shm.c | 39 +++++++++++++++++++++++++++++---------- mm/checkpoint.c | 13 ++++++++----- mm/hugetlb.c | 32 +++++++++++++++++++++++++++++++- 6 files changed, 100 insertions(+), 17 deletions(-)
fs/hugetlbfs/inode.c +22 -1
@@ -32,6 +32,7 @@#include <linux/security.h> #include <linux/magic.h> #include <linux/migrate.h> +#include <linux/checkpoint.h> #include <asm/uaccess.h>
@@ -448,6 +449,23 @@ static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr)return 0 ; } +#ifdef CONFIG_CHECKPOINT +static const struct file_operations hugetlbfs_dir_operations = { +/* Just like simple_dir_operations except... */ + .open = dcache_dir_open, + .release = dcache_dir_close, + .llseek = dcache_dir_lseek, + .read = generic_read_dir, + .readdir = dcache_readdir, + .fsync = noop_fsync, + +/* The checkpoint ops are unlike simple_dir_operations */ + .checkpoint = generic_file_checkpoint, +}; +#else +#define hugetlbfs_dir_operations simple_dir_operations +#endif +static struct inode *hugetlbfs_get_inode (struct super_block *sb,uid_t uid,gid_t gid,int mode,dev_t dev) {
@@ -483,7 +501,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid,break ;case S_IFDIR : inode->i_op = &hugetlbfs_dir_inode_operations; - inode->i_fop = &simple_dir_operations; + inode->i_fop = &hugetlbfs_dir_operations;/* directory inodes start off with i_nlink == 2 (for "." entry) */ inc_nlink (inode);
@@ -691,6 +709,9 @@ const struct file_operations hugetlbfs_file_operations = { .fsync = noop_fsync, .get_unmapped_area = hugetlb_get_unmapped_area, .llseek = default_llseek, +#ifdef CONFIG_CHECKPOINT + .checkpoint = generic_file_checkpoint, +#endif };static const struct inode_operations hugetlbfs_dir_inode_operations = {
include/linux/checkpoint_hdr.h +3 -0
@@ -944,6 +944,8 @@ struct ckpt_hdr_vma {__u64 vm_page_prot;__u64 vm_flags;__u64 vm_pgoff; + +__u16 hugetlb_shift; } __attribute__((aligned(8)));/* page array */
@@ -1091,6 +1093,7 @@ struct ckpt_hdr_ipc_shm {__u32 mlock_uid;__u32 flags;__u32 objref; +__u16 shift;/* hugetlb */ } __attribute__((aligned(8)));struct ckpt_hdr_ipc_msg {
include/linux/hugetlb.h +7 -0
@@ -48,6 +48,8 @@ int checkpoint_dump_hugetlb(struct ckpt_ctx *ctx, struct page *page);int restore_read_hugetlb (struct ckpt_ctx *ctx,struct page *page);struct page *consider_hugetlb_private_page (struct vm_area_struct *vma,unsigned long addr); +struct page *consider_hugetlb_shared_page (struct file *file, +unsigned long idx);#endif int dequeue_hwpoisoned_huge_page (struct page *page);
@@ -135,6 +137,11 @@ static inline struct page *consider_hugetlb_private_page(struct vm_area_struct * {return ERR_PTR (-ENOSYS ); } +static inline struct page *consider_hugetlb_shared_page (struct file *file, +unsigned long idx) +{ +return ERR_PTR (-ENOSYS ); +}#endif #endif /* !CONFIG_HUGETLB_PAGE */
ipc/checkpoint_shm.c +29 -10
@@ -61,8 +61,8 @@ static int fill_ipc_shm_hdr(struct ckpt_ctx *ctx,/* check if shm was setup with SHM_HUGETLB (unsupported yet) */ if (is_file_hugepages (shp->shm_file)) { -pr_warning ("c/r: unsupported SHM_HUGETLB\n" ); - ret = -ENOSYS ; + h->flags |=SHM_HUGETLB ; + h->shift =huge_page_shift (hstate_file (shp->shm_file)); }else {struct shmem_inode_info *info;
@@ -173,6 +173,15 @@ static int ipc_shm_delete(void *data)return ret; } +static void __load_ipc_shm_hdr (const struct ckpt_hdr_ipc_shm *h,struct shmid_kernel *shp) +{ + shp->shm_atim = h->shm_atim; + shp->shm_dtim = h->shm_dtim; + shp->shm_ctim = h->shm_ctim; + shp->shm_cprid = h->shm_cprid; + shp->shm_lprid = h->shm_lprid; +} +/* called with the msgids->rw_mutex is write-held */ static int load_ipc_shm_hdr(struct ckpt_ctx *ctx, struct ckpt_hdr_ipc_shm *h,
@@ -190,11 +199,7 @@ static int load_ipc_shm_hdr(struct ckpt_ctx *ctx,if (h->shm_cprid <0 || h->shm_lprid <0 )return -EINVAL ; - shp->shm_atim = h->shm_atim; - shp->shm_dtim = h->shm_dtim; - shp->shm_ctim = h->shm_ctim; - shp->shm_cprid = h->shm_cprid; - shp->shm_lprid = h->shm_lprid; +__load_ipc_shm_hdr (h, shp);return 0 ; }
@@ -206,6 +211,7 @@ int restore_ipc_shm(struct ckpt_ctx *ctx, struct ipc_namespace *ns)struct shmid_kernel *shp;struct ipc_ids *shm_ids = &ns->ids[IPC_SHM_IDS ];struct file *file; +unsigned long addr;int shmflag;int ret;
@@ -217,15 +223,13 @@ int restore_ipc_shm(struct ckpt_ctx *ctx, struct ipc_namespace *ns)if (h->perms.id <0 ) goto out; -#define CKPT_SHMFL_MASK (SHM_NORESERVE | SHM_HUGETLB) +#define CKPT_SHMFL_MASK (SHM_NORESERVE)if (h->flags & ~CKPT_SHMFL_MASK ) goto out; ret = -ENOSYS ;if (h->mlock_uid != (unsigned int )-1 )/* FIXME: support SHM_LOCK */ goto out; -if (h->flags &SHM_HUGETLB )/* FIXME: support SHM_HUGETLB */ - goto out; shmflag = h->flags | h->perms.mode |IPC_CREAT |IPC_EXCL ; ckpt_debug("shm: do_shmget size %lld flag %#x id %d\n",
@@ -294,7 +298,22 @@ int restore_ipc_shm(struct ckpt_ctx *ctx, struct ipc_namespace *ns) ret =ckpt_obj_insert (ctx, file, h->objref,CKPT_OBJ_FILE );if (ret <0 ) goto fput; + +if (is_file_hugepages (file)) { + ret =do_shmat_ns_pgoff (ns, shp->shm_perm.id, + (char __user *)0 ,0 , &addr,0 ,0 ); +if (ret <0 ) + goto fput; +ckpt_debug ("temporarily using %#lx for huge shm\n" , addr); + } + ret =restore_memory_contents (ctx, file,0 ); + +if (is_file_hugepages (file)) { +sys_shmdt ((void __user *) addr); +__load_ipc_shm_hdr (h, shp); + } + fput:fput (file);
mm/checkpoint.c +8 -5
@@ -327,7 +327,7 @@ static int vma_fill_pgarr(struct ckpt_ctx *ctx,else if (!huge)/* !vma && !huge */ page =consider_shared_page (file, addr);else /* !vma && huge */ - page =ERR_PTR (-EINVAL ); + page =consider_hugetlb_shared_page (file, addr);if (IS_ERR (page)) { cnt =PTR_ERR (page);
@@ -444,10 +444,10 @@ int checkpoint_memory_contents(struct ckpt_ctx *ctx, end = vma->vm_end; addr = vma->vm_start; }else { - huge =0 ; - pagesize =PAGE_SIZE ; - end =PAGE_ALIGN (i_size_read (file->f_dentry->d_inode)) - >>PAGE_CACHE_SHIFT ; +struct inode *ino = file->f_dentry->d_inode; + huge =is_file_hugepages (file); + pagesize = huge ?huge_page_size (hstate_inode (ino)) :PAGE_SIZE ; + end =ALIGN (i_size_read (ino), pagesize) >> (ffs (pagesize) -1 ); addr =0 ; }
@@ -546,6 +546,9 @@ int generic_vma_checkpoint(struct ckpt_ctx *ctx, struct vm_area_struct *vma, h->vm_flags = vma->vm_flags; h->vm_pgoff = vma->vm_pgoff; +if (is_vm_hugetlb_page (vma)) + h->hugetlb_shift =huge_page_shift (hstate_vma (vma)); + ret =ckpt_write_obj (ctx, &h->h);ckpt_hdr_put (ctx, h);
mm/hugetlb.c +31 -1
@@ -2136,7 +2136,7 @@ static int hugetlb_vm_op_fault(struct vm_area_struct *vma, struct vm_fault *vmf)struct page *consider_hugetlb_private_page (struct vm_area_struct *vma,unsigned long addr) { - sturct page *page; +struct page *page;int ret, nr =1 ; ret = follow_hugetlb_page(vma->vm_mm, vma, &page, NULL,
@@ -2149,6 +2149,36 @@ struct page *consider_hugetlb_private_page(struct vm_area_struct *vma,return page; } +struct page *consider_hugetlb_shared_page (struct file *file,unsigned long idx) +{ +struct address_space *mapping = file->f_mapping; +struct page *page; + + page =find_get_page (mapping, idx); + +/* +* Only care about dirty pages; find_get_page() only returns +* pages that have been allocated, so they must be dirty. The +* pages returned are referenced. +*/ + +if (page) { +/* +* If users can be writing to this page using arbitrary +* virtual addresses, take care about potential aliasing +* before reading the page on the kernel side. +*/ +if (mapping_writably_mapped (mapping)) +flush_dcache_page (page); +/* +* Mark the page accessed if we read the beginning. +*/ +mark_page_accessed (page); + } + +return page; +} +int checkpoint_dump_hugetlb (struct ckpt_ctx *ctx,struct page *head) {unsigned int nr_pages;
Signature · 1 line
1.7.1
Hi Nathan,
Thanks for the series.
I merged patches 1-3 into v23-rc1.
I posted a reworked version of patches 7-11 for (your) review. I did not apply 4-6 yet, see my replies to 4,5 first.
Cheers,
Oren
Quoted 30 lines · Nathan Lynch
Hi Oren,
Here is the hugetlb code rebased to latest ckpt-v22-dev, along with support for BSR device mappings and a minor fix or two.
Nathan Lynch (11):
checkpoint: fix leak in VMA restore error path
checkpoint: check actual array size before dereferencing
checkpoint: reformatCKPT_VMA_NOT_SUPPORTED
checkpoint: introduce device vma type
checkpoint: allow VM_{IO,RESERVED,PFNMAP} mappings
checkpoint: enable c/r for bsr driver checkpoint/ipc: allow shmat callers to specify ipc namespace checkpoint/restart of anonymous hugetlb mappings hugetlbfs checkpoint/restart hooks checkpoint/restart of SysVSHM_HUGETLBregions removeVM_HUGETLBfromCKPT_VMA_NOT_SUPPORTEDdrivers/char/bsr.c | 13 ++ fs/hugetlbfs/inode.c | 24 ++++- include/linux/checkpoint.h | 17 ++- include/linux/checkpoint_hdr.h | 18 +++ include/linux/hugetlb.h | 11 ++ include/linux/shm.h | 8 +- ipc/checkpoint_shm.c | 154 ++++++++++++++++++++++-- ipc/shm.c | 18 ++-- mm/checkpoint.c | 55 ++++++++- mm/hugetlb.c | 257 ++++++++++++++++++++++++++++++++++++++++ 10 files changed, 543 insertions(+), 32 deletions(-)