[6/7] Handle vmsplice failure for read mode pre-dump

Submitted by abhishek dubey on Aug. 20, 2019, 11:07 p.m.

Details

Message ID 1566342422-18459-7-git-send-email-dubeyabhishek777@gmail.com
State New
Series "GSoC 19: Optimizing the Pre-dump Algorithm"
Headers show

Commit Message

abhishek dubey Aug. 20, 2019, 11:07 p.m.
vmsplice fails to completely splice 512 pages
from user-buffer to ppb pipes. Last page is
partially spliced.
To overcome this, we will have ppb pipes of 512
pages but splicing will be of 511 pages at most.

Signed-off-by: Abhishek Dubey <dubeyabhishek777@gmail.com>
---
 criu/page-pipe.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/page-pipe.c b/criu/page-pipe.c
index a821696..8730654 100644
--- a/criu/page-pipe.c
+++ b/criu/page-pipe.c
@@ -38,6 +38,10 @@  static int __ppb_resize_pipe(struct page_pipe_buf *ppb, unsigned long new_size)
 		return -1;
 
 	ret /= PAGE_SIZE;
+
+	if (opts.pre_dump_mode == PRE_DUMP_READ)
+		ret -= 1;
+
 	BUG_ON(ret < ppb->pipe_size);
 
 	pr_debug("Grow pipe %x -> %x\n", ppb->pipe_size, ret);

Comments

Andrei Vagin Aug. 22, 2019, 3:15 p.m.
On Wed, Aug 21, 2019 at 04:37:01AM +0530, Abhishek Dubey wrote:
> vmsplice fails to completely splice 512 pages
> from user-buffer to ppb pipes. Last page is
> partially spliced.
> To overcome this, we will have ppb pipes of 512
> pages but splicing will be of 511 pages at most.
> 
> Signed-off-by: Abhishek Dubey <dubeyabhishek777@gmail.com>
> ---
>  criu/page-pipe.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/criu/page-pipe.c b/criu/page-pipe.c
> index a821696..8730654 100644
> --- a/criu/page-pipe.c
> +++ b/criu/page-pipe.c
> @@ -38,6 +38,10 @@ static int __ppb_resize_pipe(struct page_pipe_buf *ppb, unsigned long new_size)
>  		return -1;
>  
>  	ret /= PAGE_SIZE;
> +
> +	if (opts.pre_dump_mode == PRE_DUMP_READ)
> +		ret -= 1;

you need to add a comment here which explains why we need this
decrement.
> +
>  	BUG_ON(ret < ppb->pipe_size);
>  
>  	pr_debug("Grow pipe %x -> %x\n", ppb->pipe_size, ret);
> -- 
> 2.7.4
>