Page MenuHomeFreeBSD

Reduce bufdaemon/bufspacedaemon shutdown time
ClosedPublic

Authored by mav on Jan 18 2022, 11:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 14, 5:22 AM
Unknown Object (File)
Oct 9 2024, 5:31 AM
Unknown Object (File)
Sep 22 2024, 6:34 PM
Unknown Object (File)
Sep 18 2024, 11:38 PM
Unknown Object (File)
Sep 18 2024, 6:53 AM
Unknown Object (File)
Sep 18 2024, 12:02 AM
Unknown Object (File)
Sep 16 2024, 3:44 AM
Unknown Object (File)
Sep 12 2024, 3:42 PM
Subscribers

Details

Summary

Before this change bufdaemon and bufspacedaemon threads used kthread_shutdown() to stop activity on system shutdown. The problem is that kthread_shutdown() has no idea about the wait channel and lock used by specific thread to wake them up reliably. As result, up to 9 threads could consume up to 9 seconds to shutdown for no good reason.

This change introduces specific shutdown functions, knowing how to properly wake up specific threads, reducing wait for those threads on shutdown/reboot from average 4 seconds to effectively zero.

Test Plan

Confirmed much faster reboots on both VM and hardware systems.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mav requested review of this revision.Jan 18 2022, 11:37 PM

Rename _exit() into _shutdown().

Nice, thanks.

sys/kern/vfs_bio.c
768
799
3411
3456
This revision is now accepted and ready to land.Jan 19 2022, 12:03 AM
mav marked 4 inline comments as done.Jan 19 2022, 12:28 AM

It would be good if somebody reviewed what "syncer" does while printing zeroes for 4 seconds on shutdown/reboot. I have suspicion that it just wastes time for NFS or ZFS roots. It annoys me for years.

This revision was automatically updated to reflect the committed changes.