From: Olaf Hering <olaf@aepfle.de>
To: xen-devel@lists.xensource.com
Subject: [PATCH 8 of 9] xenpaging: move page_buffer into struct xenpaging
Date: Mon, 20 Feb 2012 21:48:10 +0100 [thread overview]
Message-ID: <bb3de3bbdff3ea9da31f.1329770890@probook.site> (raw)
In-Reply-To: <patchbomb.1329770882@probook.site>
# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1329769124 -3600
# Node ID bb3de3bbdff3ea9da31f421053cae65999d15c89
# Parent c137d7bd207b7b21d69bd6470be285023a4c2baf
xenpaging: move page_buffer into struct xenpaging
Signed-off-by: Olaf Hering <olaf@aepfle.de>
diff -r c137d7bd207b -r bb3de3bbdff3 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c
+++ b/tools/xenpaging/xenpaging.c
@@ -44,7 +44,6 @@ static char *dom_path;
static char watch_token[16];
static char *filename;
static int interrupted;
-static void *paging_buffer = NULL;
static void unlink_pagefile(void)
{
@@ -441,8 +440,8 @@ static struct xenpaging *xenpaging_init(
goto err;
}
- paging_buffer = init_page();
- if ( !paging_buffer )
+ paging->paging_buffer = init_page();
+ if ( !paging->paging_buffer )
{
PERROR("Creating page aligned load buffer");
goto err;
@@ -465,6 +464,11 @@ static struct xenpaging *xenpaging_init(
xs_close(paging->xs_handle);
if ( xch )
xc_interface_close(xch);
+ if ( paging->paging_buffer )
+ {
+ munlock(paging->paging_buffer, PAGE_SIZE);
+ free(paging->paging_buffer);
+ }
if ( paging->mem_event.shared_page )
{
munlock(paging->mem_event.shared_page, PAGE_SIZE);
@@ -687,7 +691,7 @@ static int xenpaging_populate_page(struc
DPRINTF("populate_page < gfn %lx pageslot %d\n", gfn, i);
/* Read page */
- ret = read_page(paging->fd, paging_buffer, i);
+ ret = read_page(paging->fd, paging->paging_buffer, i);
if ( ret != 0 )
{
PERROR("Error reading page");
@@ -697,8 +701,7 @@ static int xenpaging_populate_page(struc
do
{
/* Tell Xen to allocate a page for the domain */
- ret = xc_mem_paging_load(xch, paging->mem_event.domain_id, gfn,
- paging_buffer);
+ ret = xc_mem_paging_load(xch, paging->mem_event.domain_id, gfn, paging->paging_buffer);
if ( ret < 0 )
{
if ( errno == ENOMEM )
diff -r c137d7bd207b -r bb3de3bbdff3 tools/xenpaging/xenpaging.h
--- a/tools/xenpaging/xenpaging.h
+++ b/tools/xenpaging/xenpaging.h
@@ -49,6 +49,8 @@ struct xenpaging {
unsigned long *slot_to_gfn;
int *gfn_to_slot;
+ void *paging_buffer;
+
struct mem_event mem_event;
int fd;
/* number of pages for which data structures were allocated */
next prev parent reply other threads:[~2012-02-20 20:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-20 20:48 [PATCH 0 of 9] tools/xenpaging: cleanups and performance improvements Olaf Hering
2012-02-20 20:48 ` [PATCH 1 of 9] xenpaging: use flat index for pagefile and page-in requests Olaf Hering
2012-02-20 20:48 ` [PATCH 2 of 9] xenpaging: no poll timeout while page-out is in progress Olaf Hering
2012-02-20 20:48 ` [PATCH 3 of 9] xenpaging: reduce number of qemu cache flushes Olaf Hering
2012-02-20 20:48 ` [PATCH 4 of 9] xenpaging: move nominate+evict into single function Olaf Hering
2012-02-20 20:48 ` [PATCH 5 of 9] xenpaging: improve performance in policy_choose_victim Olaf Hering
2012-02-20 20:48 ` [PATCH 6 of 9] xenpaging: unify error handling Olaf Hering
2012-02-20 20:48 ` [PATCH 7 of 9] xenpaging: move pagefile filedescriptor into struct xenpaging Olaf Hering
2012-02-20 20:48 ` Olaf Hering [this message]
2012-02-20 20:48 ` [PATCH 9 of 9] xenpaging: implement stack of free slots in pagefile Olaf Hering
2012-02-21 17:38 ` [PATCH 0 of 9] tools/xenpaging: cleanups and performance improvements Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bb3de3bbdff3ea9da31f.1329770890@probook.site \
--to=olaf@aepfle.de \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).