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)
Feb 16 2024, 2:39 AM
Unknown Object (File)
Feb 14 2024, 4:26 AM
Unknown Object (File)
Feb 8 2024, 10:01 PM
Unknown Object (File)
Jan 10 2024, 11:43 PM
Unknown Object (File)
Dec 26 2023, 10:54 AM
Unknown Object (File)
Dec 20 2023, 3:52 AM
Unknown Object (File)
Nov 23 2023, 6:28 AM
Unknown Object (File)
Nov 19 2023, 9:45 AM
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.