Re: [PATCH 4/4] KVM: MMU: Make mmu_shrink() scan nr_to_scan shadow pages

2011-12-19 Thread Avi Kivity
On 12/16/2011 04:58 PM, Takuya Yoshikawa wrote: I'm not sure this is a meaningful test to verify this change is worthwhile, because while the shrinker tries to free a shadow page from one vm, the vm's position in the kvm list is changed, so the over time the shrinker will cycle over all

Re: [PATCH 4/4] KVM: MMU: Make mmu_shrink() scan nr_to_scan shadow pages

2011-12-19 Thread Takuya Yoshikawa
(2011/12/19 17:43), Avi Kivity wrote: Well, if one guest is twice as large as other guests, then it will want twice as many shadow pages. So our goal should be to zap pages from the guest with the highest (shadow pages / memory) ratio. Can you measure whether there is a significant

Re: [PATCH 4/4] KVM: MMU: Make mmu_shrink() scan nr_to_scan shadow pages

2011-12-19 Thread Avi Kivity
On 12/19/2011 11:22 AM, Takuya Yoshikawa wrote: Yes, it's very conservative. But on the other hand the shrinker is tuned for dcache and icache, where there are usually tons of useless objects. If we have to free something, I'd rather free them instead of mmu pages which tend to get recreated

Re: [PATCH 4/4] KVM: MMU: Make mmu_shrink() scan nr_to_scan shadow pages

2011-12-19 Thread Takuya Yoshikawa
(2011/12/19 18:26), Avi Kivity wrote: On 12/19/2011 11:22 AM, Takuya Yoshikawa wrote: Yes, it's very conservative. But on the other hand the shrinker is tuned for dcache and icache, where there are usually tons of useless objects. If we have to free something, I'd rather free them instead of

Re: [PATCH 4/4] KVM: MMU: Make mmu_shrink() scan nr_to_scan shadow pages

2011-12-19 Thread Avi Kivity
On 12/19/2011 11:56 AM, Takuya Yoshikawa wrote: (2011/12/19 18:26), Avi Kivity wrote: On 12/19/2011 11:22 AM, Takuya Yoshikawa wrote: Yes, it's very conservative. But on the other hand the shrinker is tuned for dcache and icache, where there are usually tons of useless objects. If we have

Re: [PATCH 4/4] KVM: MMU: Make mmu_shrink() scan nr_to_scan shadow pages

2011-12-19 Thread Takuya Yoshikawa
(2011/12/19 19:03), Avi Kivity wrote: IMO, The goal should be restricted to emergencies. So possible solution may be: - we set the tuning parameters as conservative as possible - pick up a guest with relatively high ratio (I have to think more how to achieve this) - move

Re: [PATCH 4/4] KVM: MMU: Make mmu_shrink() scan nr_to_scan shadow pages

2011-12-19 Thread Avi Kivity
On 12/19/2011 12:21 PM, Takuya Yoshikawa wrote: (2011/12/19 19:03), Avi Kivity wrote: IMO, The goal should be restricted to emergencies. So possible solution may be: - we set the tuning parameters as conservative as possible - pick up a guest with relatively high ratio (I

Re: [PATCH 4/4] KVM: MMU: Make mmu_shrink() scan nr_to_scan shadow pages

2011-12-16 Thread Marcelo Tosatti
On Mon, Dec 12, 2011 at 07:26:47AM +0900, Takuya Yoshikawa wrote: From: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Currently, mmu_shrink() tries to free a shadow page from one kvm and does not use nr_to_scan correctly. This patch fixes this by making it try to free some shadow pages

Re: [PATCH 4/4] KVM: MMU: Make mmu_shrink() scan nr_to_scan shadow pages

2011-12-16 Thread Takuya Yoshikawa
On Fri, 16 Dec 2011 09:06:11 -0200 Marcelo Tosatti mtosa...@redhat.com wrote: On Mon, Dec 12, 2011 at 07:26:47AM +0900, Takuya Yoshikawa wrote: From: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Currently, mmu_shrink() tries to free a shadow page from one kvm and does not use

[PATCH 4/4] KVM: MMU: Make mmu_shrink() scan nr_to_scan shadow pages

2011-12-11 Thread Takuya Yoshikawa
From: Takuya Yoshikawa yoshikawa.tak...@oss.ntt.co.jp Currently, mmu_shrink() tries to free a shadow page from one kvm and does not use nr_to_scan correctly. This patch fixes this by making it try to free some shadow pages from each kvm. The number of shadow pages each kvm frees becomes