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

Nick Piggin
2005-03-22T06:41:16Z

Hugh Dickins wrote:
> On Mon, 21 Mar 2005, David S. Miller wrote:
>
>>On Tue, 22 Mar 2005 15:14:54 +1100
>>Nick Piggin <nickpiggin@yahoo.com.au> wrote:
>>
>>
>>>Question, Dave: flush_tlb_pgtables after Hugh's patch is also
>>>possibly not being called with enough range to cover all page
>>>tables that have been freed.
>
>
> Good question from Nick.
>
>
>>>For example, you may have a single page (start,end) address range
>>>to free, but if this is enclosed by a large enough (floor,ceiling)
>>>then it may free an entire pgd entry.
>>>
>>>I assume the intention of the API would be to provide the full
>>>pgd width in that case?
>>
>>It just wants the range of page tables liberated. I guess
>>essentially PMD_SIZE is the granularity.
>
>
> I _think_ that answer means that my current code is fine in this respect.
> But I'm not entirely convinced. Since sparc64 is the only architecture
> which implements a flush_tlb_pgtables which actually uses start,end,
> we do need to suit your needs there - informed reassurance welcome!
>

But Hugh I think you may still be freeing pgd (PGDIR_SIZE)
regions that you don't quite cover with flush_tlb_pgtables?

I would have thought you'd need something like this:

if (!tlb_is_full_mm(tlb)) {
/* This is the full range of page tables we could possibly free */
start = max(start & PGDIR_SIZE, (floor + PMD_SIZE - 1) & PMD_SIZE);
end = min((end + PGDIR_SIZE - 1) & PGDIR_SIZE, ceiling & PMD_SIZE);
flush_tlb_pgtables(tlb->mm, start, end);
}

But I'll have to go away and look at it more...