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

[Xen-API] [PATCH 03 of 12] [PCR0047] Adds the predicates "VM_memory_cons

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 03 of 12] [PCR0047] Adds the predicates "VM_memory_constraints.are_{pinned, pinned_at_static_max, valid, valid_and_pinned_at_static_max}", which take a set of memory constraints and return true if (and only if) the constraints match some condition
From: Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
Date: Mon, 1 Feb 2010 16:32:05 +0000
Delivery-date: Mon, 01 Feb 2010 08:35:51 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1265041922@radon>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
# Date 1265039942 0
# Node ID 647fd458b3759aaa726a4fa5fffb28eab378ba15
# Parent  3aaa09cfd961b30c2d3af22e3b057d4c22203d9c
[PCR0047] Adds the predicates "VM_memory_constraints.are_{pinned, 
pinned_at_static_max, valid, valid_and_pinned_at_static_max}", which take a set 
of memory constraints and return true if (and only if) the constraints match 
some condition.

Signed-off-by: Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>

diff -r 3aaa09cfd961 -r 647fd458b375 ocaml/util/vm_memory_constraints.ml
--- a/ocaml/util/vm_memory_constraints.ml       Mon Feb 01 15:59:01 2010 +0000
+++ b/ocaml/util/vm_memory_constraints.ml       Mon Feb 01 15:59:02 2010 +0000
@@ -28,6 +28,22 @@
                static_max  : Int64.t;
        }
 
+       (** Given a set of constraints [c], returns [true] if and only if
+           [c.dynamic_min] = [c.dynamic_max]. *)
+       val are_pinned : constraints:t -> bool
+
+       (** Given a set of constraints [c], returns [true] if and only if
+           [c.dynamic_min] = [c.dynamic_max] = [c.static-max]. *)
+       val are_pinned_at_static_max : constraints:t -> bool
+
+       (** Given a set of constraints [c], returns [true] if and only if
+           [c.static_min] â?¤ [c.dynamic_min] â?¤ [c.dynamic_max] â?¤ 
[c.static_max]. *)
+       val are_valid : constraints:t -> bool
+
+       (** Given a set of constraints [c], returns [true] if and only if
+           [c.static_min] â?¤ [c.dynamic_min] = [c.dynamic_max] = 
[c.static-max]. *)
+       val are_valid_and_pinned_at_static_max : constraints:t -> bool
+
        (** Creates a set of memory constraints from the given tuple whose
          * elements appear in order of increasing size.
          *)
@@ -52,11 +68,6 @@
          * modifying the dynamic constraints, this function function returns 
None.
          *)
        val transform : constraints:t -> t option
-
-       (** Returns true if and only if the given memory constraints are in 
valid
-         * order such that: static_min <= dynamic_min <= dynamic_max <= 
static_max
-         *)
-       val are_valid : constraints:t -> bool
 
        (** Takes the given set of possibly-invalid memory constraints {i s}, 
and
          * returns a new set of valid and unballooned constraints {i t} s.t.:
@@ -114,13 +125,21 @@
                        dynamic_max = dynamic_max;
                }
 
-       let are_valid ~constraints =
-               Listext.List.is_sorted compare [
-                       constraints.static_min;
-                       constraints.dynamic_min;
-                       constraints.dynamic_max;
-                       constraints.static_max
-               ]
+       let are_pinned ~constraints =
+               constraints.dynamic_min = constraints.dynamic_max
+
+       let are_pinned_at_static_max ~constraints = true
+               && constraints.dynamic_max = constraints.static_max
+               && are_pinned constraints
+
+       let are_valid ~constraints = true
+               && constraints.static_min <= constraints.dynamic_min
+               && constraints.dynamic_min <= constraints.dynamic_max
+               && constraints.dynamic_max <= constraints.static_max
+
+       let are_valid_and_pinned_at_static_max ~constraints = true
+               && constraints.static_min <= constraints.dynamic_min
+               && are_pinned_at_static_max constraints
 
        let reset_to_safe_defaults ~constraints = 
                let max = constraints.static_max in
1 file changed, 31 insertions(+), 12 deletions(-)
ocaml/util/vm_memory_constraints.ml |   43 +++++++++++++++++++++++++----------


Attachment: xen-api.hg-12.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>