From 7c267ae75e4ddb00eaddc90ab4cd0e4127158fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= Date: Wed, 13 Nov 2024 17:35:10 +0000 Subject: [PATCH] CP-49141: Mark the DB lock as high priority: try to avoid voluntary Thread.yield while we hold it We'd still yield when the tick thread yields, or on syscalls. --- ocaml/database/db_lock.ml | 6 ++++-- ocaml/database/dune | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ocaml/database/db_lock.ml b/ocaml/database/db_lock.ml index 4de02abfa0..e893050f58 100644 --- a/ocaml/database/db_lock.ml +++ b/ocaml/database/db_lock.ml @@ -79,9 +79,11 @@ module ReentrantLock : REENTRANT_LOCK = struct let current_tid () = Thread.(self () |> id) - let[@inline never] [@specialize never] lock_acquired () = () + let[@inline never] [@specialize never] lock_acquired () = + Xapi_timeslice.Timeslice.lock_acquired () - let[@inline never] [@specialize never] lock_released () = () + let[@inline never] [@specialize never] lock_released () = + Xapi_timeslice.Timeslice.lock_released () let lock l = let me = current_tid () in diff --git a/ocaml/database/dune b/ocaml/database/dune index b748c32de2..1b67e2146d 100644 --- a/ocaml/database/dune +++ b/ocaml/database/dune @@ -48,6 +48,7 @@ xapi-stdext-std xapi-stdext-threads xapi-stdext-unix + xapi_timeslice xml-light2 xmlm )