Patchwork [1/2] kvm: powerpc: mark page accessed when mapping a guest page

login
register
mail settings
Submitter Bharat Bhushan
Date Aug. 7, 2013, 10:03 a.m.
Message ID <1375869826-17509-2-git-send-email-Bharat.Bhushan@freescale.com>
Download mbox | patch
Permalink /patch/265459/
State New
Headers show

Comments

Bharat Bhushan - Aug. 7, 2013, 10:03 a.m.
Mark the guest page as accessed so that there is likely
less chances of this page getting swap-out.

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
---
 arch/powerpc/kvm/e500_mmu_host.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Scott Wood - Aug. 10, 2013, 1:12 a.m.
On Wed, 2013-08-07 at 15:33 +0530, Bharat Bhushan wrote:
> Mark the guest page as accessed so that there is likely
> less chances of this page getting swap-out.
> 
> Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
> ---
>  arch/powerpc/kvm/e500_mmu_host.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
> index 001a2b0..ff6dd66 100644
> --- a/arch/powerpc/kvm/e500_mmu_host.c
> +++ b/arch/powerpc/kvm/e500_mmu_host.c
> @@ -246,6 +246,9 @@ static inline void kvmppc_e500_ref_setup(struct tlbe_ref *ref,
>  	/* Use guest supplied MAS2_G and MAS2_E */
>  	ref->flags |= (gtlbe->mas2 & MAS2_ATTRIB_MASK) | wimg;
>  
> +	/* Mark the page accessed */
> +	kvm_set_pfn_accessed(pfn);
> +
>  	if (tlbe_is_writable(gtlbe))
>  		kvm_set_pfn_dirty(pfn);
>  }

Acked-by: Scott Wood <scottwood@freescale.com>

...though it would be nice to be able to handle accessed/dirty at once,
without having to repeat kvm_is_mmio_pfn() and such.

-Scott



--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Graf - Oct. 4, 2013, 1:35 p.m.
On 07.08.2013, at 12:03, Bharat Bhushan wrote:

> Mark the guest page as accessed so that there is likely
> less chances of this page getting swap-out.
> 
> Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>

Thanks, applied to kvm-ppc-queue.


Alex

> ---
> arch/powerpc/kvm/e500_mmu_host.c |    3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
> index 001a2b0..ff6dd66 100644
> --- a/arch/powerpc/kvm/e500_mmu_host.c
> +++ b/arch/powerpc/kvm/e500_mmu_host.c
> @@ -246,6 +246,9 @@ static inline void kvmppc_e500_ref_setup(struct tlbe_ref *ref,
> 	/* Use guest supplied MAS2_G and MAS2_E */
> 	ref->flags |= (gtlbe->mas2 & MAS2_ATTRIB_MASK) | wimg;
> 
> +	/* Mark the page accessed */
> +	kvm_set_pfn_accessed(pfn);
> +
> 	if (tlbe_is_writable(gtlbe))
> 		kvm_set_pfn_dirty(pfn);
> }
> -- 
> 1.7.0.4
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c
index 001a2b0..ff6dd66 100644
--- a/arch/powerpc/kvm/e500_mmu_host.c
+++ b/arch/powerpc/kvm/e500_mmu_host.c
@@ -246,6 +246,9 @@  static inline void kvmppc_e500_ref_setup(struct tlbe_ref *ref,
 	/* Use guest supplied MAS2_G and MAS2_E */
 	ref->flags |= (gtlbe->mas2 & MAS2_ATTRIB_MASK) | wimg;
 
+	/* Mark the page accessed */
+	kvm_set_pfn_accessed(pfn);
+
 	if (tlbe_is_writable(gtlbe))
 		kvm_set_pfn_dirty(pfn);
 }