Page MenuHomeFreeBSD

Fix inverse sleep logic in buf_daemon()
ClosedPublic

Authored by mav on Jan 14 2022, 4:11 AM.

Details

Summary

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

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
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.