From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: [PATCH] qemu-dm: add command to flush buffer cache Date: Thu, 12 Jan 2012 19:22:23 +0100 Message-ID: <20120112182222.GA12596@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Add support for a xenstore dm command to flush qemu's buffer cache. qemu will just keep mapping pages and not release them, which causes problems for the memory pager (since the page is mapped, it won't get paged out). When the pager has trouble finding a page to page out, it asks qemu to flush its buffer, which releases all the page mappings. This makes it possible to find pages to swap out agian. Signed-off-by: Patrick Colp Signed-off-by: Olaf Hering --- ioemu-remote/xenstore.c | 3 +++ 1 file changed, 3 insertions(+) --- ioemu-remote/xenstore.c +++ ioemu-remote/xenstore.c @@ -927,6 +927,9 @@ static void xenstore_process_dm_command_ do_pci_add(par); free(par); #endif + } else if (!strncmp(command, "flush-cache", len)) { + fprintf(logfile, "dm-command: flush caches\n"); + qemu_invalidate_map_cache(); } else { fprintf(logfile, "dm-command: unknown command\"%*s\"\n", len, command); }