[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1221082738.6781.59.camel@nimitz>
Date: Wed, 10 Sep 2008 14:38:58 -0700
From: Dave Hansen <dave@...ux.vnet.ibm.com>
To: Oren Laadan <orenl@...columbia.edu>
Cc: arnd@...db.de, jeremy@...p.org, linux-kernel@...r.kernel.org,
containers@...ts.linux-foundation.org
Subject: Re: [RFC v4][PATCH 4/9] Memory management (dump)
On Tue, 2008-09-09 at 03:42 -0400, Oren Laadan wrote:
> array chain
> + */
> +static int cr_vma_scan_pages(struct cr_ctx *ctx, struct vm_area_struct *vma)
> +{
> + unsigned long addr = vma->vm_start;
> + unsigned long end = vma->vm_end;
> + struct cr_pgarr *pgarr;
> + int nr, total = 0;
> +
> + while (addr < end) {
> + pgarr = cr_pgarr_prep(ctx);
> + if (!pgarr)
> + return -ENOMEM;
> + nr = cr_vma_fill_pgarr(ctx, pgarr, vma, &addr);
> + if (nr < 0)
> + return nr;
> + pgarr->nr_free -= nr;
> + pgarr->nr_used += nr;
> + total += nr;
> + }
> +
> + cr_debug("total %d\n", total);
> + return total;
> +}
This confuses me. cr_vma_fill_pgarr() if it runs into an error attempts
to free up the pgarr references from the current pgarr that was just
filled. But, that could only be a portion of a large VMA. If it can't
free up the entire VMA worth of references (at least), why does it even
try to free a portion? Why not just return since the upper levels need
to clean up the other portions anyway?
Also, is it really necessary to track the total amount filled in here?
I kinda gums up the code.
-- 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