Skip to content

Commit

Permalink
CP-49141: Mark the DB lock as high priority: try to avoid voluntary T…
Browse files Browse the repository at this point in the history
…hread.yield while we hold it

We'd still yield when the tick thread yields, or on syscalls.
  • Loading branch information
edwintorok committed Dec 11, 2024
1 parent 42aa383 commit 7c267ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ocaml/database/db_lock.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions ocaml/database/dune
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
xapi-stdext-std
xapi-stdext-threads
xapi-stdext-unix
xapi_timeslice
xml-light2
xmlm
)
Expand Down

0 comments on commit 7c267ae

Please sign in to comment.