diff mbox

[Xen-devel,v4,1/7] xen: introduce gnttab_max_nr_maptrack_frames command line option

Message ID 1412941440-5646-1-git-send-email-stefano.stabellini@eu.citrix.com
State New
Headers show

Commit Message

Stefano Stabellini Oct. 10, 2014, 11:43 a.m. UTC
Introduce a new Xen command line option to specify the max number of
maptrack frames per domain.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 docs/misc/xen-command-line.markdown |    6 ++++++
 xen/common/grant_table.c            |   11 +++++------
 2 files changed, 11 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index 389701a..acf6208 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -613,6 +613,12 @@  Specify the serial parameters for the GDB stub.
 
 Specify the maximum number of frames per grant table operation.
 
+### gnttab\_max\_nr\_maptrack\_frames
+> `= <integer>`
+
+Specify the maximum number of maptrack frames domain.
+The default value is 8 times gnttab_max_nr_frames.
+
 ### guest\_loglvl
 > `= <level>[/<rate-limited level>]` where level is `none | error | warning | info | debug | all`
 
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 23266c3..5451c75 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -102,10 +102,9 @@  nr_maptrack_frames(struct grant_table *t)
     return t->maptrack_limit / MAPTRACK_PER_PAGE;
 }
 
-static unsigned inline int max_nr_maptrack_frames(void)
-{
-    return (max_nr_grant_frames * MAX_MAPTRACK_TO_GRANTS_RATIO);
-}
+static unsigned int max_nr_maptrack_frames = DEFAULT_MAX_NR_GRANT_FRAMES *
+                                             MAX_MAPTRACK_TO_GRANTS_RATIO;
+integer_param("gnttab_max_nr_maptrack_frames", max_nr_maptrack_frames);
 
 #define MAPTRACK_TAIL (~0u)
 
@@ -271,7 +270,7 @@  get_maptrack_handle(
     while ( unlikely((handle = __get_maptrack_handle(lgt)) == -1) )
     {
         nr_frames = nr_maptrack_frames(lgt);
-        if ( nr_frames >= max_nr_maptrack_frames() )
+        if ( nr_frames >= max_nr_maptrack_frames )
             break;
 
         new_mt = alloc_xenheap_page();
@@ -2659,7 +2658,7 @@  grant_table_create(
 
     /* Tracking of mapped foreign frames table */
     if ( (t->maptrack = xzalloc_array(struct grant_mapping *,
-                                      max_nr_maptrack_frames())) == NULL )
+                                      max_nr_maptrack_frames)) == NULL )
         goto no_mem_2;
     if ( (t->maptrack[0] = alloc_xenheap_page()) == NULL )
         goto no_mem_3;