[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1221075083.6781.34.camel@nimitz>
Date: Wed, 10 Sep 2008 12:31:23 -0700
From: Dave Hansen <dave@...ux.vnet.ibm.com>
To: Oren Laadan <orenl@...columbia.edu>
Cc: containers@...ts.linux-foundation.org, jeremy@...p.org,
linux-kernel@...r.kernel.org, arnd@...db.de
Subject: Re: [RFC v4][PATCH 5/9] Memory managemnet (restore)
On Tue, 2008-09-09 at 03:42 -0400, Oren Laadan wrote:
> +/**
> + * cr_vma_read_pages_vaddrs - read addresses of pages to page-array chain
> + * @ctx - restart context
> + * @npages - number of pages
> + */
> +static int cr_vma_read_pages_vaddrs(struct cr_ctx *ctx, int npages)
> +{
> + struct cr_pgarr *pgarr;
> + int nr, ret;
> +
> + while (npages) {
> + pgarr = cr_pgarr_prep(ctx);
> + if (!pgarr)
> + return -ENOMEM;
> + nr = min(npages, (int) pgarr->nr_free);
> + ret = cr_kread(ctx, pgarr->vaddrs, nr * sizeof(unsigned long));
> + if (ret < 0)
> + return ret;
> + pgarr->nr_free -= nr;
> + pgarr->nr_used += nr;
> + npages -= nr;
> + }
> + return 0;
> +}
cr_pgarr_prep() can return a partially full pgarr, right? Won't the
cr_kread() always start at the beginning of the pgarr->vaddrs[] array?
Seems to me like it will clobber things from the last call.
-- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists