Skip to content

Commit 382d48b

Browse files
committed
CP-53642: change default NUMA placement policy to best-effort
We've seen that using the policy can be up to 10% faster than using any is some workflows, while not observing workflows that were negatively affected. The policy per VM can always be change if need be. Note that currently sometime the best-effort falls back to the same behaviour, especially when restarting on starting more than one VM at a time. This needs xen patches to be fixed: https://lore.kernel.org/xen-devel/[email protected]/T/#ma1246e352ea3cce71c7ddc26d1329a368548b3b2 Also fix the legacy numa-placement configuration option for xenopsd. It was always deciding the setting, even when not used, now it only takes effect when it's present, otherwise it leaves the default option untouched. Signed-off-by: Pau Ruiz Safont <[email protected]>
1 parent 983a48a commit 382d48b

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

ocaml/xenopsd/lib/xenops_server.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3472,9 +3472,9 @@ module VIF = struct
34723472
()
34733473
end
34743474

3475-
let default_numa_affinity_policy = ref Xenops_interface.Host.Any
3475+
let default_numa_affinity_policy = ref Xenops_interface.Host.Best_effort
34763476

3477-
let numa_placement = ref Xenops_interface.Host.Any
3477+
let numa_placement = ref !default_numa_affinity_policy
34783478

34793479
let string_of_numa_affinity_policy =
34803480
Xenops_interface.Host.(function Any -> "any" | Best_effort -> "best-effort")

ocaml/xenopsd/lib/xenopsd.ml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,17 @@ let feature_flags_path = ref "/etc/xenserver/features.d"
5959

6060
let pvinpvh_xen_cmdline = ref "pv-shim console=xen"
6161

62-
let numa_placement_compat = ref false
62+
(* This is a deprecated argument. If it's not set, use the default numa
63+
placement policy, otherwise true means to use Best effort, and false to use
64+
Any *)
65+
let numa_placement_compat = ref None
66+
67+
let set_default_numa_placement () =
68+
let change_default numa_enabled =
69+
Xenops_server.default_numa_affinity_policy :=
70+
if numa_enabled then Best_effort else Any
71+
in
72+
Option.iter change_default !numa_placement_compat
6373

6474
(* O(N^2) operations, until we get a xenstore cache, so use a small number here *)
6575
let vm_guest_agent_xenstore_quota = ref 128
@@ -242,8 +252,10 @@ let options =
242252
, "Command line for the inner-xen for PV-in-PVH guests"
243253
)
244254
; ( "numa-placement"
245-
, Arg.Bool (fun x -> numa_placement_compat := x)
246-
, (fun () -> string_of_bool !numa_placement_compat)
255+
, Arg.Bool (fun x -> numa_placement_compat := Some x)
256+
, (fun () ->
257+
Option.fold ~none:"true" ~some:string_of_bool !numa_placement_compat
258+
)
247259
, "NUMA-aware placement of VMs (deprecated, use XAPI setting)"
248260
)
249261
; ( "pci-quarantine"

ocaml/xenopsd/xc/xenops_server_xen.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5294,8 +5294,7 @@ let init () =
52945294
{Xs_protocol.ACL.owner= 0; other= Xs_protocol.ACL.READ; acl= []}
52955295
) ;
52965296
Device.Backend.init () ;
5297-
Xenops_server.default_numa_affinity_policy :=
5298-
if !Xenopsd.numa_placement_compat then Best_effort else Any ;
5297+
Xenopsd.set_default_numa_placement () ;
52995298
info "Default NUMA affinity policy is '%s'"
53005299
Xenops_server.(string_of_numa_affinity_policy !default_numa_affinity_policy) ;
53015300
Xenops_server.numa_placement := !Xenops_server.default_numa_affinity_policy ;

0 commit comments

Comments
 (0)