Skip to content

Commit c9ec87b

Browse files
committed
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. Signed-off-by: Edwin Török <[email protected]>
1 parent 8862cfc commit c9ec87b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

ocaml/database/db_lock.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@ module ReentrantLock : REENTRANT_LOCK = struct
7979

8080
let current_tid () = Thread.(self () |> id)
8181

82-
let[@inline never] [@specialize never] lock_acquired () = ()
82+
let[@inline never] [@specialize never] lock_acquired () =
83+
Xapi_timeslice.Timeslice.lock_acquired ()
8384

84-
let[@inline never] [@specialize never] lock_released () = ()
85+
let[@inline never] [@specialize never] lock_released () =
86+
Xapi_timeslice.Timeslice.lock_released ()
8587

8688
let lock l =
8789
let me = current_tid () in

ocaml/database/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
xapi-stdext-std
4949
xapi-stdext-threads
5050
xapi-stdext-unix
51+
xapi_timeslice
5152
xml-light2
5253
xmlm
5354
)

0 commit comments

Comments
 (0)