[01/16] mem/page-pipe: Eliminate redundant pipe_off setup

Submitted by Cyrill Gorcunov on July 5, 2019, 3:37 p.m.

Details

Message ID 20190705153811.22652-2-gorcunov@gmail.com
State Accepted
Series "mem: Cleanup and fixups"
Headers show

Commit Message

Cyrill Gorcunov July 5, 2019, 3:37 p.m.
In case if we may use previous pipe the pipe_off
get set directly so no need for redundat unconditional
assignment.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 criu/page-pipe.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/page-pipe.c b/criu/page-pipe.c
index c32b89332521..33741db4224f 100644
--- a/criu/page-pipe.c
+++ b/criu/page-pipe.c
@@ -104,8 +104,6 @@  static struct page_pipe_buf *ppb_alloc(struct page_pipe *pp,
 		return NULL;
 	cnt_add(CNT_PAGE_PIPE_BUFS, 1);
 
-	ppb->pipe_off = 0;
-
 	if (prev && ppb_resize_pipe(prev) == 0) {
 		/* The previous pipe isn't full and we can continue to use it. */
 		ppb->p[0] = prev->p[0];
@@ -120,6 +118,7 @@  static struct page_pipe_buf *ppb_alloc(struct page_pipe *pp,
 		}
 		cnt_add(CNT_PAGE_PIPES, 1);
 
+		ppb->pipe_off = 0;
 		ppb->pipe_size = fcntl(ppb->p[0], F_GETPIPE_SZ, 0) / PAGE_SIZE;
 		pp->nr_pipes++;
 	}

Comments

Mike Rapoport July 8, 2019, 12:33 p.m.
On Fri, Jul 05, 2019 at 06:37:56PM +0300, Cyrill Gorcunov wrote:
> In case if we may use previous pipe the pipe_off
> get set directly so no need for redundat unconditional
> assignment.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>

Not a huge gain, but still

Acked-by: Mike Rapoport <rppt@linux.ibm.com>

> ---
>  criu/page-pipe.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/criu/page-pipe.c b/criu/page-pipe.c
> index c32b89332521..33741db4224f 100644
> --- a/criu/page-pipe.c
> +++ b/criu/page-pipe.c
> @@ -104,8 +104,6 @@ static struct page_pipe_buf *ppb_alloc(struct page_pipe *pp,
>  		return NULL;
>  	cnt_add(CNT_PAGE_PIPE_BUFS, 1);
>  
> -	ppb->pipe_off = 0;
> -
>  	if (prev && ppb_resize_pipe(prev) == 0) {
>  		/* The previous pipe isn't full and we can continue to use it. */
>  		ppb->p[0] = prev->p[0];
> @@ -120,6 +118,7 @@ static struct page_pipe_buf *ppb_alloc(struct page_pipe *pp,
>  		}
>  		cnt_add(CNT_PAGE_PIPES, 1);
>  
> +		ppb->pipe_off = 0;
>  		ppb->pipe_size = fcntl(ppb->p[0], F_GETPIPE_SZ, 0) / PAGE_SIZE;
>  		pp->nr_pipes++;
>  	}
> -- 
> 2.20.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
>