|
|
Subscribe / Log in / New account

Restartable sequences in glibc

Restartable sequences in glibc

Posted Feb 1, 2022 1:57 UTC (Tue) by compudj (subscriber, #43335)
In reply to: Restartable sequences in glibc by roc
Parent article: Restartable sequences in glibc

AFAIK glibc expects to do heavy use of rseq. The initial use-case is to speed up sched_getcpu() on various architectures, but they also want to use it other future improvements internal to glibc.

So glibc is not just wiring rseq up for the application. It expects to use it as well even before the application main() is started.

I tried to keep track of all rseq "early adopter" open source projects (e.g. tcmalloc), and they have been made aware that they would have to update their userspace ABI to adapt to the glibc ABI. It was not an issue for them. I maintain librseq, which I have adapted to co-exist with glibc 2.35 and older glibc as well. I have not made any official release of this librseq project yet especially because I was awaiting a final choice on the userspace ABI, which is now happening with glibc 2.35. I have also sent a patch series to Peter Zijlstra to update the Linux kernel rseq selftests so they can co-exist with glibc 2.35. It is queued in the tip tree for the next merge window.


to post comments

Restartable sequences in glibc

Posted Feb 1, 2022 14:29 UTC (Tue) by khim (subscriber, #9252) [Link]

Looks like the notion this is clearly not a feature that is intended for casual or frequent use, but it can evidently produce significant performance gains in systems with high scalability requirements is completely wrong: it would absolutely be the feature which many apps would be “frequently using”… although not directly but because small handful of very low-level libraries would adopt it eagerly.

Restartable sequences in glibc

Posted Feb 1, 2022 21:37 UTC (Tue) by NYKevin (subscriber, #129325) [Link] (2 responses)

Is there a compatibility story for those libs getting linked into something that doesn't link to glibc (e.g. because it uses musl or something)? Or are those users just out of luck?

Musl

Posted Feb 1, 2022 21:49 UTC (Tue) by corbet (editor, #1) [Link]

Marginally related: the musl developer isn't entirely happy with the glibc plan and would like to see it delayed.

Restartable sequences in glibc

Posted Feb 2, 2022 11:41 UTC (Wed) by compudj (subscriber, #43335) [Link]

librseq can be used as an alternative way to register rseq for cases where the libc does not handle rseq. It requires the application to explicitly call a register/unregister API at the beginning/end of each thread's lifetime. It is compatible with the glibc-2.35+ ABI as well and will let glibc handle rseq registration in those cases. See https://git.kernel.org/pub/scm/libs/librseq/librseq.git/


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds