[PATCH v2] arm/arm64: KVM: Fix and refactor unmap_range

Steve Capper steve.capper at linaro.org
Wed Jun 4 06:59:32 PDT 2014


On 4 June 2014 14:30, Christoffer Dall <christoffer.dall at linaro.org> wrote:
> On Tue, Jun 03, 2014 at 02:52:58PM +0100, Steve Capper wrote:

[ ... ]

>>
>> I don't quite follow this clear_p[um]d_entry logic.
>> So this clear_pmd_entry will de-allocate the page containing the ptes
>> (referenced from the pmd entry)?
>
> Yes.
>
>> If so, what happens if not all the ptes in the page need to be unmapped?
>
> Well, then pte_table_empty() will return false (because there are still
> active pte's in the pte table) and we won't call the function.
>
> The idea is that we ref-count each page table page with the number of
> active entries in that page (in addition to the initial reference from
> allocating the table).  So a ref-count of 1 means that there are no
> active entries (xxx_table_empty() returns true), a refcount of 513 means
> there are 512 active entries.
>
> Makes sense?

Thanks Christoffer,
Yes that makes perfect sense.

Cheers,
-- 
Steve



More information about the linux-arm-kernel mailing list