All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: xen-devel@lists.xensource.com
Subject: [PATCH 01/12] xenpaging: remove domain_id and mfn from struct xenpaging_victim
Date: Mon, 10 Jan 2011 17:43:46 +0100	[thread overview]
Message-ID: <20110110164345.879405628@aepfle.de> (raw)
In-Reply-To: 20110110164345.521919826@aepfle.de

[-- Attachment #1: xen-unstable.xenpaging.no_domain_id.patch --]
[-- Type: text/plain, Size: 6856 bytes --]

Remove unused member 'mfn' from struct xenpaging_victim.

xenpaging operates on a single guest, so it needs only a single domain_id.
Remove domain_id from struct xenpaging_victim and use the one from
paging->mem_event where needed. Its not used in the policy.

This saves 4MB runtime data with a 1GB pagefile.

Signed-off-by: Olaf Hering <olaf@aepfle.de>

---
 tools/xenpaging/policy.h         |    7 +++----
 tools/xenpaging/policy_default.c |   10 +++-------
 tools/xenpaging/xenpaging.c      |   26 ++++++++++++--------------
 tools/xenpaging/xenpaging.h      |    4 ----
 4 files changed, 18 insertions(+), 29 deletions(-)

--- xen-unstable.hg-4.1.22694.orig/tools/xenpaging/policy.h
+++ xen-unstable.hg-4.1.22694/tools/xenpaging/policy.h
@@ -29,10 +29,9 @@
 
 
 int policy_init(xenpaging_t *paging);
-int policy_choose_victim(xenpaging_t *paging, domid_t domain_id,
-                         xenpaging_victim_t *victim);
-void policy_notify_paged_out(domid_t domain_id, unsigned long gfn);
-void policy_notify_paged_in(domid_t domain_id, unsigned long gfn);
+int policy_choose_victim(xenpaging_t *paging, xenpaging_victim_t *victim);
+void policy_notify_paged_out(unsigned long gfn);
+void policy_notify_paged_in(unsigned long gfn);
 
 #endif // __XEN_PAGING_POLICY_H__
 
--- xen-unstable.hg-4.1.22694.orig/tools/xenpaging/policy_default.c
+++ xen-unstable.hg-4.1.22694/tools/xenpaging/policy_default.c
@@ -67,16 +67,12 @@ int policy_init(xenpaging_t *paging)
     return rc;
 }
 
-int policy_choose_victim(xenpaging_t *paging, domid_t domain_id,
-                         xenpaging_victim_t *victim)
+int policy_choose_victim(xenpaging_t *paging, xenpaging_victim_t *victim)
 {
     xc_interface *xch = paging->xc_handle;
     unsigned long wrap = current_gfn;
     ASSERT(victim != NULL);
 
-    /* Domain to pick on */
-    victim->domain_id = domain_id;
-
     do
     {
         current_gfn++;
@@ -96,13 +92,13 @@ int policy_choose_victim(xenpaging_t *pa
     return 0;
 }
 
-void policy_notify_paged_out(domid_t domain_id, unsigned long gfn)
+void policy_notify_paged_out(unsigned long gfn)
 {
     set_bit(gfn, bitmap);
     clear_bit(gfn, unconsumed);
 }
 
-void policy_notify_paged_in(domid_t domain_id, unsigned long gfn)
+void policy_notify_paged_in(unsigned long gfn)
 {
     unsigned long old_gfn = mru[i_mru & (MRU_SIZE - 1)];
 
--- xen-unstable.hg-4.1.22694.orig/tools/xenpaging/xenpaging.c
+++ xen-unstable.hg-4.1.22694/tools/xenpaging/xenpaging.c
@@ -171,7 +171,7 @@ xenpaging_t *xenpaging_init(domid_t doma
         goto err;
     }
 
-    rc = xc_get_platform_info(xch, domain_id,
+    rc = xc_get_platform_info(xch, paging->mem_event.domain_id,
                               paging->platform_info);
     if ( rc != 1 )
     {
@@ -187,7 +187,7 @@ xenpaging_t *xenpaging_init(domid_t doma
         goto err;
     }
 
-    rc = xc_domain_getinfolist(xch, domain_id, 1,
+    rc = xc_domain_getinfolist(xch, paging->mem_event.domain_id, 1,
                                paging->domain_info);
     if ( rc != 1 )
     {
@@ -348,7 +348,7 @@ int xenpaging_evict_page(xenpaging_t *pa
     /* Map page */
     gfn = victim->gfn;
     ret = -EFAULT;
-    page = xc_map_foreign_pages(xch, victim->domain_id,
+    page = xc_map_foreign_pages(xch, paging->mem_event.domain_id,
                                 PROT_READ | PROT_WRITE, &gfn, 1);
     if ( page == NULL )
     {
@@ -380,7 +380,7 @@ int xenpaging_evict_page(xenpaging_t *pa
     }
 
     /* Notify policy of page being paged out */
-    policy_notify_paged_out(paging->mem_event.domain_id, victim->gfn);
+    policy_notify_paged_out(victim->gfn);
 
  out:
     return ret;
@@ -397,7 +397,7 @@ static int xenpaging_resume_page(xenpagi
 
     /* Notify policy of page being paged in */
     if ( notify_policy )
-        policy_notify_paged_in(paging->mem_event.domain_id, rsp->gfn);
+        policy_notify_paged_in(rsp->gfn);
 
     /* Tell Xen page is ready */
     ret = xc_mem_paging_resume(paging->xc_handle, paging->mem_event.domain_id,
@@ -464,7 +464,7 @@ static int xenpaging_populate_page(xenpa
     return ret;
 }
 
-static int evict_victim(xenpaging_t *paging, domid_t domain_id,
+static int evict_victim(xenpaging_t *paging,
                         xenpaging_victim_t *victim, int fd, int i)
 {
     xc_interface *xch = paging->xc_handle;
@@ -473,7 +473,7 @@ static int evict_victim(xenpaging_t *pag
 
     do
     {
-        ret = policy_choose_victim(paging, domain_id, victim);
+        ret = policy_choose_victim(paging, victim);
         if ( ret != 0 )
         {
             if ( ret != -ENOSPC )
@@ -486,14 +486,13 @@ static int evict_victim(xenpaging_t *pag
             ret = -EINTR;
             goto out;
         }
-        ret = xc_mem_paging_nominate(xch,
-                                     paging->mem_event.domain_id, victim->gfn);
+        ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, victim->gfn);
         if ( ret == 0 )
             ret = xenpaging_evict_page(paging, victim, fd, i);
         else
         {
             if ( j++ % 1000 == 0 )
-                if ( xc_mem_paging_flush_ioemu_cache(domain_id) )
+                if ( xc_mem_paging_flush_ioemu_cache(paging->mem_event.domain_id) )
                     ERROR("Error flushing ioemu cache");
         }
     }
@@ -578,7 +577,7 @@ int main(int argc, char *argv[])
     memset(victims, 0, sizeof(xenpaging_victim_t) * num_pages);
     for ( i = 0; i < num_pages; i++ )
     {
-        rc = evict_victim(paging, domain_id, &victims[i], fd, i);
+        rc = evict_victim(paging, &victims[i], fd, i);
         if ( rc == -ENOSPC )
             break;
         if ( rc == -EINTR )
@@ -619,8 +618,7 @@ int main(int argc, char *argv[])
                 /* Find where in the paging file to read from */
                 for ( i = 0; i < num_pages; i++ )
                 {
-                    if ( (victims[i].domain_id == paging->mem_event.domain_id) &&
-                         (victims[i].gfn == req.gfn) )
+                    if ( victims[i].gfn == req.gfn )
                         break;
                 }
     
@@ -652,7 +650,7 @@ int main(int argc, char *argv[])
                 }
 
                 /* Evict a new page to replace the one we just paged in */
-                evict_victim(paging, domain_id, &victims[i], fd, i);
+                evict_victim(paging, &victims[i], fd, i);
             }
             else
             {
--- xen-unstable.hg-4.1.22694.orig/tools/xenpaging/xenpaging.h
+++ xen-unstable.hg-4.1.22694/tools/xenpaging/xenpaging.h
@@ -49,12 +49,8 @@ typedef struct xenpaging {
 
 
 typedef struct xenpaging_victim {
-    /* the domain to evict a page from */
-    domid_t domain_id;
     /* the gfn of the page to evict */
     unsigned long gfn;
-    /* the mfn of evicted page */
-    unsigned long mfn;
 } xenpaging_victim_t;

  reply	other threads:[~2011-01-10 16:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-10 16:43 [PATCH 00/12] xenpaging changes for xen-unstable Olaf Hering
2011-01-10 16:43 ` Olaf Hering [this message]
2011-01-10 16:43 ` [PATCH 02/12] xenpaging: specify policy mru_size at runtime Olaf Hering
2011-01-10 16:43 ` [PATCH 03/12] xenpaging: mkdir /var/lib/xen/xenpaging during make install Olaf Hering
2011-01-10 16:43 ` [PATCH 04/12] xenpaging: print page-in/page-out progress Olaf Hering
2011-01-10 16:43 ` [PATCH 05/12] xenpaging: make three functions static Olaf Hering
2011-01-11 18:36   ` Ian Jackson
2011-01-10 16:43 ` [PATCH 06/12] xenpaging: update machine_to_phys_mapping[] during page deallocation Olaf Hering
2011-01-11 10:37   ` Keir Fraser
2011-01-11 11:00     ` Olaf Hering
2011-01-11 11:29       ` Keir Fraser
2011-01-10 16:43 ` [PATCH 07/12] xenpaging: update machine_to_phys_mapping[] during page-in Olaf Hering
2011-01-10 16:43 ` [PATCH 08/12] xenpaging: drop paged pages in guest_remove_page Olaf Hering
2011-01-14 16:53   ` Olaf Hering
2011-01-10 16:43 ` [PATCH 09/12] xenpaging: prevent page-out of gfn 0x80 Olaf Hering
2011-01-10 16:43 ` [PATCH 10/12] xenpaging: handle HVMCOPY_gfn_paged_out in copy_from/to_user Olaf Hering
2011-01-10 16:43 ` [PATCH 11/12] xenpaging: start xenpaging via config option Olaf Hering
2011-01-10 16:43 ` [PATCH 12/12] xenpaging: document missing live migration Olaf Hering
2011-01-11 17:20 ` [PATCH 00/12] xenpaging changes for xen-unstable 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=20110110164345.879405628@aepfle.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.