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
Unknown Object (File)
Feb 22 2024, 3:35 PM
Unknown Object (File)
Dec 20 2023, 2:40 AM
Unknown Object (File)
Nov 14 2023, 11:25 PM
Unknown Object (File)
Nov 14 2023, 5:35 AM
Unknown Object (File)
Nov 9 2023, 10:42 AM
Unknown Object (File)
Nov 4 2023, 6:55 AM
Unknown Object (File)
Nov 2 2023, 5:04 AM
Unknown Object (File)
Oct 13 2023, 4:38 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.