Page MenuHomeFreeBSD

Fix inverse sleep logic in buf_daemon()

Authored by mav on Jan 14 2022, 4:11 AM.
Referenced Files
Unknown Object (File)
Fri, Nov 24, 11:52 PM
Unknown Object (File)
Sep 23 2023, 11:06 PM
Unknown Object (File)
Aug 29 2023, 10:07 PM
Unknown Object (File)
Jul 4 2023, 2:11 AM
Unknown Object (File)
Jul 4 2023, 2:09 AM
Unknown Object (File)
Jul 4 2023, 2:09 AM
Unknown Object (File)
Jul 1 2023, 9:15 AM
Unknown Object (File)
May 21 2023, 10:46 AM



Before commit 3cec5c77d617 buf_daemon() went to longer 1s sleep if numdirtybuffers <= lodirtybuffers. After that commit new condition !BIT_EMPTY(BUF_DOMAINS, &bdlodirty) is opposite -- true when one or more more domains is above lodirtybuffers. As result, on freshly booted system with no dirty buffers buf_daemon() wakes up 10 times per second and probably only 1 time per second when there is actual work to do.

Test Plan

With the patch I see buf_daemon() wake up rate on freshly booted system drops to one time per second.

Diff Detail

rG FreeBSD src repository
Lint Not Applicable
Tests Not Applicable

Event Timeline

mav requested review of this revision.Jan 14 2022, 4:11 AM
mav retitled this revision from Inverse sleep logic in buf_daemon() to Fix inverse sleep logic in buf_daemon().Jan 14 2022, 4:33 AM
mav edited the summary of this revision. (Show Details)

Might be worth asking pho to run stress2 with the patch, to make sure that there is no other bugs uncovered by this.

This revision is now accepted and ready to land.Jan 14 2022, 8:47 AM

I ran a mix of random stress2 tests for 24 hours, without observing any problems.

This revision was automatically updated to reflect the committed changes.