[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[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



# 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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.