-
Notifications
You must be signed in to change notification settings - Fork 310
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
lib/checkout: Optimize checkout by avoiding OstreeRepoFile recusion #848
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since we now have a cleaner separation of "toplevel checkout prep" versus "recursive checkout", handle the special case of checking out a single file at first rather than later. Prep for future work in optimizing this function more.
Looking at `perf record ostree checkout`, some things stand out; e.g.: ``` + 27.63% 0.07% ostree libgio-2.0.so.0.5000.3 [.] g_file_enumerator_iterate + 22.74% 0.28% ostree libostree-1.so.1.0.0 [.] ostree_repo_file_tree_query_child + 13.74% 0.08% ostree libostree-1.so.1.0.0 [.] ot_variant_bsearch_str ``` The GIO abstractions are already fairly heavyweight, and `OstreeRepoFile` mallocs a lot too. Make things more efficient here by dropping the GIO bits for reading ostree data - we just read from the variants directly and iterate over them. The end result here is that according to perf we go from ~40% of our time in the kernel to ~70%, and things like `g_file_enumerator_iterate()` drop entirely out of the hot set.
Looks good! @rh-atomic-bot r+ a4fc72e |
rh-atomic-bot
pushed a commit
that referenced
this pull request
May 11, 2017
Looking at `perf record ostree checkout`, some things stand out; e.g.: ``` + 27.63% 0.07% ostree libgio-2.0.so.0.5000.3 [.] g_file_enumerator_iterate + 22.74% 0.28% ostree libostree-1.so.1.0.0 [.] ostree_repo_file_tree_query_child + 13.74% 0.08% ostree libostree-1.so.1.0.0 [.] ot_variant_bsearch_str ``` The GIO abstractions are already fairly heavyweight, and `OstreeRepoFile` mallocs a lot too. Make things more efficient here by dropping the GIO bits for reading ostree data - we just read from the variants directly and iterate over them. The end result here is that according to perf we go from ~40% of our time in the kernel to ~70%, and things like `g_file_enumerator_iterate()` drop entirely out of the hot set. Closes: #848 Approved by: jlebon
☀️ Test successful - status-atomicjenkins |
cgwalters
added a commit
to cgwalters/ostree
that referenced
this pull request
May 12, 2017
This is what caused the merge of coreos/rpm-ostree#652 to blow up, since ostreedev#848 landed right before we tried to merge it. When I was writing that PR I remember having an uncertain feeling since we were doing a `mkdirat` above, but at the time I thought we'd have test suite coverage...turns out we didn't. For backwards compatibility, we need to continue to do a `mkdirat` here of the parent. However...I can't think of a reason anyone would *want* that behavior. Hence, let's add a special trick - if the destination name is `.`, we skip `mkdirat()`. That way rpm-ostree for example can open a dfd for `/etc` and avoid the `mkdir`. Fold the subpath tests into `test-basic.sh` since it's not worth a separate file. Add a test case for checking out a file.
rh-atomic-bot
pushed a commit
that referenced
this pull request
May 12, 2017
This is what caused the merge of coreos/rpm-ostree#652 to blow up, since #848 landed right before we tried to merge it. When I was writing that PR I remember having an uncertain feeling since we were doing a `mkdirat` above, but at the time I thought we'd have test suite coverage...turns out we didn't. For backwards compatibility, we need to continue to do a `mkdirat` here of the parent. However...I can't think of a reason anyone would *want* that behavior. Hence, let's add a special trick - if the destination name is `.`, we skip `mkdirat()`. That way rpm-ostree for example can open a dfd for `/etc` and avoid the `mkdir`. Fold the subpath tests into `test-basic.sh` since it's not worth a separate file. Add a test case for checking out a file. Closes: #854 Approved by: jlebon
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Looking at
perf record ostree checkout
, some things stand out; e.g.:The GIO abstractions are already fairly heavyweight, and
OstreeRepoFile
mallocsa lot too.
Make things more efficient here by dropping the GIO bits for reading ostree data -
we just read from the variants directly and iterate over them. The end result
here is that according to perf we go from ~40% of our time in the kernel to
~70%, and things like
g_file_enumerator_iterate()
drop entirely out of thehot set.