Page MenuHomeFreeBSD

Use a dedicated counter for laundry thread wakeups.
ClosedPublic

Authored by markj on Dec 8 2017, 4:49 PM.
Tags
None
Referenced Files
F103216812: D13422.id36387.diff
Fri, Nov 22, 8:06 AM
Unknown Object (File)
Oct 19 2024, 6:29 PM
Unknown Object (File)
Oct 2 2024, 6:19 AM
Unknown Object (File)
Sep 30 2024, 11:26 PM
Unknown Object (File)
Sep 29 2024, 11:18 PM
Unknown Object (File)
Sep 24 2024, 9:14 AM
Unknown Object (File)
Sep 21 2024, 9:58 PM
Unknown Object (File)
Sep 16 2024, 11:48 AM
Subscribers

Details

Summary

We currently read the pdwakeups counter to determine how many inactive
queue scans were performed by the page daemon. This is used to determine
whether to start a background laundering. However, this was done before
the page daemon had a mechanism to wake up the laundry thread, notifying
it that it had just performed a scan.

It's a bit weird to read a per-CPU counter for this purpose, and I'd
like to propose a change which makes it possible for the page daemon to
scan the inactive queue multiple times without sleeping, which would
make pdwakeups unreliable. So let's use a dedicated counter, synchronized
by the PQ_LAUNDRY queue lock.

Diff Detail

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

Event Timeline

markj added reviewers: alc, kib.

I'm looking at D13424, and it doesn't appear to me that the meaning v_pdwakeups has changed. That is, it's still the case that we increment v_pdwakeups only if we are explicitly awakened. Am I missing something?

In D13422#280514, @alc wrote:

I'm looking at D13424, and it doesn't appear to me that the meaning v_pdwakeups has changed. That is, it's still the case that we increment v_pdwakeups only if we are explicitly awakened. Am I missing something?

That's correct, but the intent behind reading pdwakeups was to count the number of inactive queue scans. We might perform multiple scans after a single wakeup.

This revision is now accepted and ready to land.Dec 9 2017, 11:00 AM
In D13422#280514, @alc wrote:

I'm looking at D13424, and it doesn't appear to me that the meaning v_pdwakeups has changed. That is, it's still the case that we increment v_pdwakeups only if we are explicitly awakened. Am I missing something?

That's correct, but the intent behind reading pdwakeups was to count the number of inactive queue scans. We might perform multiple scans after a single wakeup.

Initially, I had thought that the problem that you were trying to address was that pdwakeups would be too large. Now, I see that the problem is the opposite, that pdwakeups will be too small.

sys/vm/vm_pageout.c
1367 ↗(On Diff #36387)

I'm going to predict that someone will someday will propose a "fix" to this code that moves the wakeup++ up inside the preceding braces. He or she will explain that it doesn't actually count the number of wakeups as is. A different variable might avoid this.

sys/vm/vm_pageout.c
1367 ↗(On Diff #36387)

Make that: "A different variable name might ...

This revision now requires review to proceed.Dec 9 2017, 10:34 PM
sys/vm/vm_pageout.c
162 ↗(On Diff #36417)

I think that this is better because it doesn't include "wakeups", but wouldn't something like "vm_inactq_scans" be more accurate?

sys/vm/vm_pageout.c
162 ↗(On Diff #36417)

I was going to write that I prefer "requests" since it's more abstract, but your earlier comment still applies: it doesn't really look like we're requesting a laundering unless we set vm_laundry_request. So I'll change the name.

This revision is now accepted and ready to land.Dec 11 2017, 3:33 AM
This revision was automatically updated to reflect the committed changes.