WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 01 of 10] Simplify include/xen/grant_table.h a bit:

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 01 of 10] Simplify include/xen/grant_table.h a bit:
From: <steven.smith@xxxxxxxxxx>
Date: Sun, 4 Oct 2009 16:00:31 +0100
Cc: keir.fraser@xxxxxxxxxx, joserenato.santos@xxxxxx
Delivery-date: Sun, 04 Oct 2009 08:05:07 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1254668430@xxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Steven Smith <steven.smith@xxxxxxxxxxxxx>
# Date 1222082607 -3600
# Node ID 5f2f5565914573282437bb31f790ffac1169755c
# Parent  6f63970032a3fe5fda585beba929d2d7a5e14861
Simplify include/xen/grant_table.h a bit:

-- INITIAL_GRANT_ENTRIES is never used, so can be removed.
-- Simplify num_act_frames_from_sha_frames a little.

Signed-off-by: Steven Smith <steven.smith@xxxxxxxxxx>

diff -r 6f63970032a3 -r 5f2f55659145 xen/include/xen/grant_table.h
--- a/xen/include/xen/grant_table.h     Fri Oct 02 09:10:27 2009 +0100
+++ b/xen/include/xen/grant_table.h     Mon Sep 22 12:23:27 2008 +0100
@@ -52,10 +52,6 @@
 #define GNTPIN_devr_shift    (24)
 #define GNTPIN_devr_inc      (1 << GNTPIN_devr_shift)
 #define GNTPIN_devr_mask     (0xFFU << GNTPIN_devr_shift)
-
-/* Initial size of a grant table. */
-#define INITIAL_NR_GRANT_ENTRIES ((INITIAL_NR_GRANT_FRAMES << PAGE_SHIFT) / \
-                                     sizeof(grant_entry_t))
 
 #ifndef DEFAULT_MAX_NR_GRANT_FRAMES /* to allow arch to override */
 /* Default maximum size of a grant table. [POLICY] */
@@ -128,16 +124,13 @@
 num_act_frames_from_sha_frames(const unsigned int num)
 {
     /* How many frames are needed for the active grant table,
-     * given the size of the shared grant table?
-     *
-     * act_per_page = PAGE_SIZE / sizeof(active_grant_entry_t);
-     * sha_per_page = PAGE_SIZE / sizeof(grant_entry_t);
-     * num_sha_entries = num * sha_per_page;
-     * num_act_frames = (num_sha_entries + (act_per_page-1)) / act_per_page;
-     */
-    return ((num * (PAGE_SIZE / sizeof(grant_entry_t))) +
-            ((PAGE_SIZE / sizeof(struct active_grant_entry))-1))
-           / (PAGE_SIZE / sizeof(struct active_grant_entry));
+     * given the size of the shared grant table? */
+    unsigned act_per_page = PAGE_SIZE / sizeof(struct active_grant_entry);
+    unsigned sha_per_page = PAGE_SIZE / sizeof(grant_entry_t);
+    unsigned num_sha_entries = num * sha_per_page;
+    unsigned num_act_frames =
+        (num_sha_entries + (act_per_page-1)) / act_per_page;
+    return num_act_frames;
 }
 
 static inline unsigned int
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel