Add method for per-CPU ring draining#294
Open
utpilla wants to merge 2 commits into
Open
Conversation
| hard_page_faults_builder: Option<RingBufBuilder<PageFaults>>, | ||
| next_time: Option<u64>, | ||
| oldest_cpu: Option<usize>, | ||
| cpu_reader_index: HashMap<u32, usize>, |
Collaborator
There was a problem hiding this comment.
Since we map index to CPU, lets just use a Vec here that expands to the amount of index's we have. This will speed up the lookup compared to a hash.
| self.enabled | ||
| } | ||
|
|
||
| fn begin_reading_cpu( |
Collaborator
There was a problem hiding this comment.
It would be nice to have begin_reading_cpu() return a struct that contains the reader, cursor that then is passed to read_cpu(). This would eliminate several branches and memory lookups within read_cpu() that is called in a tight loop when on a per-CPU looping path.
Collaborator
There was a problem hiding this comment.
It could also contain a copy of the ancillary as well.
This file contains hidden or 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
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.
Changes
Adds
parse_for_cpu(cpu)(Option 1 from #254) - drains and dispatches one CPU's ring, firing event callbacks likeparse_allbut scoped to a single CPU. This is the final piece of the wakeup-watermark work, completingwith_wakeup_watermark()(#276) andperf_fds()(#279).Motivation
A multi-CPU
PerfSessionregisters one perf fd per CPU with the consumer's event loop (epoll /AsyncFd). The readiness signal is per-CPU, butparse_alldrains every ring - so a wakeup on one CPU pulled events from CPUs whose watermark hadn't tripped.parse_for_cpumatches the drain to the signal: one fd fires, one ring drains.