|
|
Message-ID: <DU4PR04MB10623BB56DAD84FD4015B38D3F64E2@DU4PR04MB10623.eurprd04.prod.outlook.com> Date: Mon, 30 Nov 2026 11:33:32 +0000 From: Axel LORENTE <axel.lorente@...com> To: "musl@...ts.openwall.com" <musl@...ts.openwall.com> CC: Stanislav Meduna <Stanislav.Meduna@...com> Subject: Priority inheritance for malloc internal locks Hi, We recently hit a priority inversion issue involving malloc in our application. A high priority thread was blocked in free() on a malloc lock held by a lower priority thread. Since there is no priority inheritance on this lock, the lower priority thread could itself be preempted by intermediate priority threads. In one of our traces this resulted in the high priority thread being blocked for around 34 ms, which was enough to miss our deadline. Looking into it, I found this old change: https://git.musl-libc.org/cgit/musl/commit/src/thread?h=rs-1.0&id=4750cf4202c29a895639b89099a7bdbe9ae422b6 I understand the choice made back in 2012 and the cost of using PI for internal locks, so I don't think changing the default behavior for everyone would necessarily make sense. Would you consider having an option to build musl with priority inheritance for these locks? On our side we try to avoid allocations from real-time paths, but there is a tradeoff. Pre-allocating everything can mean reserving a lot more memory than we actually need, while allowing some allocations at runtime exposes us to this kind of priority inversion. A compile-time option, or something opt-in, would let applications with RT constraints choose that tradeoff. Is this something that could make sense for you? Thanks, Axel General
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.