diff --git a/ocaml/xenopsd/lib/topology.ml b/ocaml/xenopsd/lib/topology.ml index d60adf5498..68c5ae754e 100644 --- a/ocaml/xenopsd/lib/topology.ml +++ b/ocaml/xenopsd/lib/topology.ml @@ -169,7 +169,10 @@ module NUMA = struct (* We want to minimize maximum distance first, and average distance next. When running the VM we don't know which pCPU it'll end up using, and want to limit the worst case performance. *) - ((max_dist, float sum_dist /. float count), nodes) + if Seq.is_empty nodes then + None + else + Some ((max_dist, float sum_dist /. float count), nodes) let dist_cmp (a1, _) (b1, _) = compare a1 b1 @@ -207,7 +210,7 @@ module NUMA = struct else valid_nodes |> seq_all_subsets - |> Seq.map (node_distances d) + |> Seq.filter_map (node_distances d) |> seq_append single_nodes in nodes