Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: reduce consistent reads per mount to 1 in IsMounted based on kernel version #832

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

jakobmoellerdev
Copy link
Contributor

The consistent read issue reported in #371 has been fixed by doing a consistent read 3 times. This is not necessary as 2 consistent reads will be enough to cover page size timings.

This will severely reduce memory allocations and gc stability during LV creation:

Reasoning:
See a profiling made with 32 PVCs created and allocs collected.

image

@jakobmoellerdev jakobmoellerdev requested a review from a team as a code owner January 24, 2024 14:41
@jakobmoellerdev jakobmoellerdev changed the title chore: reduce consistent reads per mount by 1 chore: reduce consistent reads per mount by 1 in IsMounted Jan 24, 2024
@ushitora-anqou
Copy link
Contributor

I'm hesitating to change the number from 3 to 2 because most Kubernetes components seem to adopt 3 or more (link 1, link 2, link 3, and link 4).

One of my team members found that this bug in /proc/mounts was fixed in Linux 5.8. How about updating your code to check the Linux version the code is running on, and just use os.ReadFile if it is new enough?

@jakobmoellerdev
Copy link
Contributor Author

jakobmoellerdev commented Jan 25, 2024

@ushitora-anqou thanks for the insight! sure that works for me. Anything that is able to reduce these file reads will significantly reduce Allocs / Processor usage for FS based volumes.

Regarding the linux check, any preference on how to do that? Otherwise ill just copy and paste from mount utils

@jakobmoellerdev jakobmoellerdev changed the title chore: reduce consistent reads per mount by 1 in IsMounted chore: reduce consistent reads per mount to 1 in IsMounted based on kernel version Jan 25, 2024
@jakobmoellerdev
Copy link
Contributor Author

image
This looks much better :)

peng225
peng225 previously approved these changes Jan 26, 2024
filesystem/util.go Show resolved Hide resolved
Signed-off-by: Jakob Möller <jmoller@redhat.com>
@jakobmoellerdev
Copy link
Contributor Author

@peng225 would you mind reapproving again after the header license change?

@peng225 peng225 merged commit aca72a7 into topolvm:main Jan 30, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants