Re: [PATCH] A new entry for /proc

From: Hugh Dickins
Date: Wed Mar 02 2005 - 14:09:55 EST


On Wed, 2 Mar 2005, Mauricio Lin wrote:
> Does anyone know if the place I put pte_unmap is logical and safe
> after several pte increments?

The place is logical and safe, but it's still not quite right.
You should have found several examples of loops having the same
problem, and what do they do? ....

> pte = pte_offset_map(pmd, address);
> address &= ~PMD_MASK;
> end = address + size;
> if (end > PMD_SIZE)
> end = PMD_SIZE;
> do {
> pte_t page = *pte;
>
> address += PAGE_SIZE;
> pte++;
> if (pte_none(page) || (!pte_present(page)))
> continue;
> *rss += PAGE_SIZE;
> } while (address < end);
> pte_unmap(pte);

pte_unmap(pte - 1);

which works because it's a do {} while () loop which has certainly
incremented pte at least once. But some people probably loathe that
style, and would prefer to save orig_pte then pte_unmap(orig_pte).

Hugh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/