lkml.org 
[lkml]   [2008]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC v4][PATCH 4/9] Memory management (dump)
From
Date
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



\
 
 \ /
  Last update: 2008-09-10 23:41    [W:0.410 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site