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

Submitted by Abhishek Dubey on Aug. 25, 2019, 1:58 a.m.

Details

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

Commit Message

Abhishek Dubey Aug. 25, 2019, 1:58 a.m.
vmsplice fails to completely splice 2^k pages
from user-buffer to ppb pipes. Sometimes last
page is partially spliced.
To overcome this, page count for splicing is
kept 1 less than the size of pipe.

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

Patch hide | download patch | download mbox

diff --git a/criu/page-pipe.c b/criu/page-pipe.c
index a821696..aeb7246 100644
--- a/criu/page-pipe.c
+++ b/criu/page-pipe.c
@@ -40,6 +40,16 @@  static int __ppb_resize_pipe(struct page_pipe_buf *ppb, unsigned long new_size)
 	ret /= PAGE_SIZE;
 	BUG_ON(ret < ppb->pipe_size);
 
+	/*
+	 * Sometimes vmsplice fails to splice N pages(where N=2^k)
+	 * from user buffer to pipe, so restricting page-pipe
+	 * capacity to accommodate N-1 pages.
+	 * e.g. Pipe size can be 512 pages, but it's filled till
+	 * 511 pages.
+	 */
+	if (opts.pre_dump_mode == PRE_DUMP_READ)
+		ret -= 1;
+
 	pr_debug("Grow pipe %x -> %x\n", ppb->pipe_size, ret);
 	ppb->pipe_size = ret;
 

Comments

Dmitry Safonov Aug. 28, 2019, 6:25 p.m.
On 8/25/19 2:58 AM, Abhishek Dubey wrote:
> vmsplice fails to completely splice 2^k pages
> from user-buffer to ppb pipes. Sometimes last
> page is partially spliced.
> To overcome this, page count for splicing is
> kept 1 less than the size of pipe.

Could you add in the description how-to reproduce it?
It'll give us information when it's safe to drop this work-around.

Thanks,
          Dmitry