From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [RFC][Patch v8 0/7] KVM: Guest Free Page Hinting Date: Mon, 18 Feb 2019 21:45:57 -0500 Message-ID: <20190218214441-mutt-send-email-mst@kernel.org> References: <20190204201854.2328-1-nitesh@redhat.com> <20190218114601-mutt-send-email-mst@kernel.org> <44740a29-bb14-e6e6-2992-98d0ae58e994@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: David Hildenbrand , Nitesh Narayan Lal , kvm list , LKML , Paolo Bonzini , lcapitulino@redhat.com, pagupta@redhat.com, wei.w.wang@intel.com, Yang Zhang , Rik van Riel , dodgen@google.com, Konrad Rzeszutek Wilk , dhildenb@redhat.com, Andrea Arcangeli To: Alexander Duyck Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Mon, Feb 18, 2019 at 03:47:22PM -0800, Alexander Duyck wrote: > > > So far with my patch set that hints at the PMD level w/ THP enabled I > > > am not really seeing that much overhead for the hypercalls. The bigger > > > piece that is eating up CPU time is all the page faults and page > > > zeroing that is going on as we are cycling the memory in and out of > > > the guest. Some of that could probably be resolved by using MADV_FREE, > > > but if we are under actual memory pressure I suspect it would behave > > > similar to MADV_DONTNEED. > > > > > > > MADV_FREE is certainly the better thing to do for hinting in my opinion. > > It should result in even less overhead. Thanks for the comment about the > > hypercall overhead. > > Yeah, no problem. The only thing I don't like about MADV_FREE is that > you have to have memory pressure before the pages really start getting > scrubbed with is both a benefit and a drawback. Basically it defers > the freeing until you are under actual memory pressure so when you hit > that case things start feeling much slower, that and it limits your > allocations since the kernel doesn't recognize the pages as free until > it would have to start trying to push memory to swap. For sure if someone *wants* to spend cycles freeing memory, we could add a system call that does exactly that. There's no reason to force that on the same CPU while VCPU is stopped though. -- MST