From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752140AbdCQBX7 (ORCPT ); Thu, 16 Mar 2017 21:23:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42188 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751098AbdCQBX6 (ORCPT ); Thu, 16 Mar 2017 21:23:58 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6A87C624C8 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mst@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6A87C624C8 Date: Fri, 17 Mar 2017 03:21:21 +0200 From: "Michael S. Tsirkin" To: Wei Wang Cc: virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-mm@kvack.org, david@redhat.com, dave.hansen@intel.com, cornelia.huck@de.ibm.com, akpm@linux-foundation.org, mgorman@techsingularity.net, aarcange@redhat.com, amit.shah@redhat.com, pbonzini@redhat.com, liliang.opensource@gmail.com Subject: Re: [PATCH kernel v8 3/4] mm: add inerface to offer info about unused pages Message-ID: <20170317023556-mutt-send-email-mst@kernel.org> References: <1489648127-37282-1-git-send-email-wei.w.wang@intel.com> <1489648127-37282-4-git-send-email-wei.w.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1489648127-37282-4-git-send-email-wei.w.wang@intel.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 17 Mar 2017 01:21:29 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 16, 2017 at 03:08:46PM +0800, Wei Wang wrote: > +/* > + * The record_unused_pages() function is used to record the system unused > + * pages. The unused pages can be skipped to transfer during live migration. > + * Though the unused pages are dynamically changing, dirty page logging > + * mechanisms are able to capture the newly used pages though they were > + * recorded as unused pages via this function. You will keep confusing people as long as you keep using this terminology which only makes sense in a very specific use and a very specific implementation. How does guest developer know this does the right thing wrt locking etc? Look at hypervisor spec and try to figure it all out together? So stop saying what caller should do, describe what does the *API* does. You want something like this: Get a list of pages in the system that are unused at some point between record_unused_pages is called and before it returns, implying that any data that was present in these pages before record_unused_pages was called is safe to discard. Pages can be used immediately after this point and any data written after this point is not safe to discard, it is caller's responsibility to either prevent the use or detect such pages. -- MST