Re: [patch 1/3 take2] smaps: extract pte walker from smaps code

David Rientjes
2007-02-09T02:26:13Z

On Thu, 8 Feb 2007, Matt Mackall wrote:

> I've been looking at a similar refactoring of other code and I think
> the way to go is a callback per block-of-PTEs with start and end
> pointers. That gets rid of most of the call indirection overhead.
>

Yes, but only in a limited number of cases (including smaps). It is not
always sufficient to do it on the block-of-ptes level. Many of the the
pte iterators in the code right now are slightly different on each level:
the ioremap code, for example, allocates the various directories as it
progresses in depth.

To have one library pte iterator would only be possible with callback
functions on each pgd, pud, and pmd level that (at least) ioremap would
require to be implemented on top of. That isn't very appealing.

The PTI patchset from July moved these iterators into .h files but did not
implement a single pte iterator to build on. It just turned out nicely in
the smaps case that there was no difference on the pgd, pud, or pmd level
between the two required iterators. I added a void *private to carry the
struct for statistics accumulating in the smaps case but this is worthless
in the clear_refs case.

David