[CRIU] [PATCH 02/16] mem/page-pipe: create_page_pipe -- Drop redundant zero assignment
Mike Rapoport
rppt at linux.ibm.com
Mon Jul 8 15:31:39 MSK 2019
On Fri, Jul 05, 2019 at 06:37:57PM +0300, Cyrill Gorcunov wrote:
> We allocate with xzalloc, no need for additional zero assignemtns.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
> ---
> criu/page-pipe.c | 14 +++-----------
> 1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/criu/page-pipe.c b/criu/page-pipe.c
> index 33741db4224f..32be2f9812e2 100644
> --- a/criu/page-pipe.c
> +++ b/criu/page-pipe.c
> @@ -187,26 +187,18 @@ struct page_pipe *create_page_pipe(unsigned int nr_segs, struct iovec *iovs, uns
> if (!pp)
> return NULL;
>
> + INIT_LIST_HEAD(&pp->free_bufs);
> + INIT_LIST_HEAD(&pp->bufs);
> + pp->nr_iovs = nr_segs;
Why move these before iovs allocation?
I'd rather only kill zero assignments and keep the rest. Would make the
diffstat smaller ;-)
> pp->flags = flags;
>
> if (!iovs) {
> iovs = xmalloc(sizeof(*iovs) * nr_segs);
> if (!iovs)
> goto err_free_pp;
> -
> pp->flags |= PP_OWN_IOVS;
> }
> -
> - pp->nr_pipes = 0;
> - INIT_LIST_HEAD(&pp->bufs);
> - INIT_LIST_HEAD(&pp->free_bufs);
> - pp->nr_iovs = nr_segs;
> pp->iovs = iovs;
> - pp->free_iov = 0;
> -
> - pp->nr_holes = 0;
> - pp->free_hole = 0;
> - pp->holes = NULL;
>
> if (page_pipe_grow(pp, 0))
> goto err_free_iovs;
> --
> 2.20.1
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
>
--
Sincerely yours,
Mike.
More information about the CRIU
mailing list