Page MenuHomeFreeBSD

Split up deadlkres() to make it more readable.
ClosedPublic

Authored by bz on Jun 19 2018, 11:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 1, 4:12 PM
Unknown Object (File)
Nov 5 2024, 10:26 AM
Unknown Object (File)
Oct 1 2024, 1:37 PM
Unknown Object (File)
Sep 27 2024, 1:21 PM
Unknown Object (File)
Sep 27 2024, 12:48 AM
Unknown Object (File)
Sep 25 2024, 1:36 PM
Unknown Object (File)
Sep 22 2024, 9:31 PM
Unknown Object (File)
Sep 22 2024, 5:23 PM
Subscribers

Details

Summary

Split up deadlkres() to make it more readable in anticipation of
further changes adding another level of indentation.

Some of the logic got simplified with the break out functions.
There should be no functional changes.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/kern/kern_clock.c
187 ↗(On Diff #44106)

You do not need __inline. Compilers are good inlining the code for static functions when needed.

192 ↗(On Diff #44106)

I think you should add asserts indicating that allproc_lock, thread' and p' lock are owned.

It is the strange, and most important, unneeded weirdness in the interface of these two functions, that you unlock the thread before returning.

207 ↗(On Diff #44106)

BTW, why unlock ?

219 ↗(On Diff #44106)

Same locking assertion is needed.

237 ↗(On Diff #44106)

Perhaps try1 should be bool.

For the other comments it's basically the same; I moved the former inline code into sub-functions. I'll make the changes and upload a new patch.

sys/kern/kern_clock.c
207 ↗(On Diff #44106)

Dunno; the original code did; I basically just moved the former inline code into a function; I am happy to remove these and just panic.

Addressed all the comments; not unlocking for panic also
allowed us to remove the tryl variable and just return.

It means we hold the thread lock a bit longer over the string
compare if we check against blessed[]; that's a slow path so
should be fine.

bz marked 6 inline comments as done.Jul 5 2018, 4:43 PM
kib added inline comments.
sys/kern/kern_clock.c
188 ↗(On Diff #44920)

Why do you need '_' in front of the name ?

This revision is now accepted and ready to land.Jul 5 2018, 4:53 PM

Thanks for the review!

sys/kern/kern_clock.c
188 ↗(On Diff #44920)

Nope. I guess not. I'll remove them and commit.

This revision was automatically updated to reflect the committed changes.