Hi Hugh,

How about map an unmap each pte?

I mean remove the pte++ and use pte_offset_map for each incremented
address and then pte_unmap. So each incremented address is an index to
get the next pte via pte_offset_map.

BR,

Mauricio Lin.

On Wed, 2 Mar 2005 19:07:15 +0000 (GMT), Hugh Dickins <[EMAIL PROTECTED]> wrote:
> 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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to