From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFC] Expose infrastructure for unpinning guest memory Date: Fri, 12 Oct 2007 08:32:18 +0200 Message-ID: <470F14F2.7050800@qumranet.com> References: <1192138344500-git-send-email-aliguori@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Anthony Liguori Return-path: In-Reply-To: <1192138344500-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Anthony Liguori wrote: > Now that we have userspace memory allocation, I wanted to play with ballooning. > The idea is that when a guest "balloons" down, we simply unpin the underlying > physical memory and the host kernel may or may not swap it. To reclaim > ballooned memory, the guest can just start using it and we'll pin it on demand. > > The following patch is a stab at providing the right infrastructure for pinning > and automatic repinning. I don't have a lot of comfort in the MMU code so I > thought I'd get some feedback before going much further. > > gpa_to_hpa is a little awkward to hook, but it seems like the right place in the > code. I'm most uncertain about the SMP safety of the unpinning. Presumably, > I have to hold the kvm lock around the mmu_unshadow and page_cache release to > ensure that another VCPU doesn't fault the page back in after mmu_unshadow? > > One we have true swapping capabilities (which imply ability for the kernel to remove a page from the shadow page tables) you can unpin by calling munmap() or madvise(MADV_REMOVE) on the pages to be unpinned. Other than that the approach seems right. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/