Re: [PATCH 1/5] freepgt: free_pgtables use vma list

David S. Miller
2005-03-22T23:32:30Z

On Tue, 22 Mar 2005 14:40:55 -0800
"Luck, Tony" <tony.luck@intel.com> wrote:

> Then I don't see how we decide when to clear a pointer at each
> level. Are there counters of how many entries are active in each
> table at all levels (pgd/pud/pmd/pte)?

No, there are no counters.

How it works is that it knows the extent in each direction
where mappings do not exist.

Once we know we have a clear span up to the next PMD_SIZE
modulo (and PUD_SIZE and so on and so forth) we know we
can liberate the page table chunks covered by such ranges.

Say we are unmapping a page at some address. The next VMA
in the address space says where the next potentially valid
mapping resides. The previous VMA says similarly. If this
is the first or last VMA, we use the beginning or end of
the virtual address space as our value.

Play around with my little simulator I posted, you'll see how
it works ;-) Actually, this is the second such simulator you
have seen Tony :-)