lkml.org 
[lkml]   [2005]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] A new entry for /proc
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:10    [W:0.705 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site