runtime: allow FreeBSD users to choose between MADV_FREE and MADV_DONTNEED #32519
Labels
Milestone
Comments
cc @aclements |
Change https://golang.org/cl/181498 mentions this issue: |
Howdy @araujobsd, your CL https://go-review.googlesource.com/c/go/+/181498 has some comments from @bradfitz, but I see that perhaps your Gerrit account is no longer active. Could you please rebase from master, and take a look at Brad's comments? Thank you! |
Change https://golang.org/cl/266937 mentions this issue: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
On FreeBSD the resident memory of a go binary grows pathologically till the OS rans out of swap and the binary is killed. In some cases, the binary is blocked in uwait state for forever. It takes days to make it happens, but in a machine only running the "go binary" it is possible to simulate this issue with 100% of accuracy.
A way to mitigate this issue is to use MADV_DONTNEED instead of MADV_FREE, after enable it, it is possible to see the resident memory grows and shrinks as much as the "go binary" needs it. Eventually, even when the OS is under memory pressure, I have observed the OS doesn't run out of swap and the "go binary" is not being killed.
The MADV_FREE although has many performance advantages, on FreeBSD it seems to have some downside, specially because it doesn't reduce the resident memory even under OS memory pressure. I think would be useful to provide a GODEBUG option for BSD in the same way it is provided for LINUX, it might help BSD users to mitigate these issues.
Tested with FreeBSD version: HEAD, 12.0-RELEASE-p4, 12-STABLE and 11-STABLE.
The text was updated successfully, but these errors were encountered: