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-changelog

[Xen-changelog] [xen-unstable] Simplify include/xen/grant_table.h a bit:

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Simplify include/xen/grant_table.h a bit:
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 06 Oct 2009 23:55:12 -0700
Delivery-date: Tue, 06 Oct 2009 23:56:32 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1254897890 -3600
# Node ID c14b8d395c799787039d0ebc6eac89bbcb43c7ff
# Parent  006686ed2088c92ad722f7982d19b2b34413f1ed
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>
---
 xen/include/xen/grant_table.h |   21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)

diff -r 006686ed2088 -r c14b8d395c79 xen/include/xen/grant_table.h
--- a/xen/include/xen/grant_table.h     Wed Oct 07 07:43:50 2009 +0100
+++ b/xen/include/xen/grant_table.h     Wed Oct 07 07:44:50 2009 +0100
@@ -52,10 +52,6 @@ struct active_grant_entry {
 #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 uns
 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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Simplify include/xen/grant_table.h a bit:, Xen patchbot-unstable <=