From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uop9V-00025z-5q for qemu-devel@nongnu.org; Tue, 18 Jun 2013 02:12:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uop9U-00055H-5X for qemu-devel@nongnu.org; Tue, 18 Jun 2013 02:12:25 -0400 Received: from e28smtp07.in.ibm.com ([122.248.162.7]:42636) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uop9T-000551-DE for qemu-devel@nongnu.org; Tue, 18 Jun 2013 02:12:24 -0400 Received: from /spool/local by e28smtp07.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 18 Jun 2013 11:35:31 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id BEE8F125804E for ; Tue, 18 Jun 2013 11:41:14 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5I6CMuK28377166 for ; Tue, 18 Jun 2013 11:42:23 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5I6CGHk018916 for ; Tue, 18 Jun 2013 16:12:16 +1000 Message-ID: <51BFFA07.8040201@linux.vnet.ibm.com> Date: Tue, 18 Jun 2013 14:11:19 +0800 From: Lei Li MIME-Version: 1.0 References: <1371397053-4503-1-git-send-email-lilei@linux.vnet.ibm.com> <1371397053-4503-4-git-send-email-lilei@linux.vnet.ibm.com> <878v2ahwj1.fsf@codemonkey.ws> In-Reply-To: <878v2ahwj1.fsf@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/7] arch_init: add ram_madvise_free() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: lagarcia@br.ibm.com, qemu-devel@nongnu.org, quintela@redhat.com On 06/17/2013 12:04 AM, Anthony Liguori wrote: > Lei Li writes: > >> Signed-off-by: Lei Li >> --- >> arch_init.c | 13 +++++++++++++ >> include/migration/migration.h | 3 +++ >> 2 files changed, 16 insertions(+), 0 deletions(-) >> >> diff --git a/arch_init.c b/arch_init.c >> index 872020e..fc66bd2 100644 >> --- a/arch_init.c >> +++ b/arch_init.c >> @@ -524,6 +524,19 @@ uint64_t ram_bytes_total(void) >> return total; >> } >> >> +void ram_madvise_free(ram_addr_t size) >> +{ >> + void *ram; >> + RAMBlock *block = NULL; >> + >> + ram = memory_region_get_ram_ptr(block->mr); >> + >> + /* XXX. Here just simplely madvise(.., MADV_DONTNEED) the whole ram >> + * pages, need more work to keep MADV_DONTNEED ram pages that >> + * already sent. */ >> + qemu_madvise(ram, size, MADV_DONTNEED); >> +} >> + > I don't think this is right at all. There's no guarantee we have a > single linear mapping of all ram. Ah, thanks for yourclarification! > > I think you need something a bit more clever than this. Yes, this need more work. > >> static void migration_end(void) >> { >> if (migration_bitmap) { >> diff --git a/include/migration/migration.h b/include/migration/migration.h >> index 8866c3c..9cc5285 100644 >> --- a/include/migration/migration.h >> +++ b/include/migration/migration.h >> @@ -21,6 +21,7 @@ >> #include "qapi/error.h" >> #include "migration/vmstate.h" >> #include "qapi-types.h" >> +#include "exec/memory.h" >> >> enum { >> MIG_STATE_ERROR, >> @@ -100,6 +101,8 @@ uint64_t ram_bytes_remaining(void); >> uint64_t ram_bytes_transferred(void); >> uint64_t ram_bytes_total(void); >> >> +void ram_madvise_free(ram_addr_t size); >> + > If you introduce new interfaces, please include documentation in the > header. Good to know, thanks! > Regards, > > Anthony Liguori > >> extern SaveVMHandlers savevm_ram_handlers; >> >> uint64_t dup_mig_bytes_transferred(void); >> -- >> 1.7.7.6 -- Lei