Page MenuHomeFreeBSD

libthr: drop use of try_gc in the end of thr_join
Needs ReviewPublic

Authored by aokblast on Tue, Oct 13, 10:43 PM.
Tags
None
Referenced Files
F176312049: D60717.diff
Sat, Oct 17, 8:20 PM
Unknown Object (File)
Fri, Oct 16, 4:13 PM
Unknown Object (File)
Fri, Oct 16, 4:11 PM
Unknown Object (File)
Thu, Oct 15, 1:18 PM
Unknown Object (File)
Wed, Oct 14, 5:09 PM
Unknown Object (File)
Wed, Oct 14, 7:09 AM
Unknown Object (File)
Wed, Oct 14, 1:07 AM
Unknown Object (File)
Wed, Oct 14, 12:54 AM
Subscribers

Details

Reviewers
kib
markj
Summary

thr_try_gc unlock and lock again to make sure the lock order. However,
there is no reason for such roundtrip if the caller holds the correct
oder. As a result, we create a new helper function to add the thread
to gc list without unlock + lock and wire the join_common to this new helper.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 78157
Build 75040: arc lint + arc unit

Event Timeline

The change now takes the thread list write lock unconditionally. Before the change, it only happen if the thread is not referenced. Did you checked that this is innocent?

lib/libthr/thread/thr_join.c
96

This helper as is does not make much sense after your change. Perhaps another helper that does everything up to, but not including, the thr_try_gc() call would be useful, but not this single-use function that can be inlined in the single use place.

118

There is no need in tmp, you can assign directly. It is arguably not needed in the join_common_joined().